添加带有二进制的自定义操作来复制文件

问题描述 投票:0回答:1

当有人升级到较新版本的软件时,我想复制该文件(UpgradeScripts.sql)并将其粘贴到已安装 PC 上的 ProgramFiles/Pharm/Database 文件夹中。我正在使用 Wix CustomActions 来执行此操作。当我尝试这样做时,它的抱怨如下。请帮助我如何做到这一点。

CustomAction/@BinaryKey 属性不能与以前的属性共存 该元素上的指定属性。 CustomAction 元素可以 一次只能指定以下源属性之一: BinaryKey、目录、文件密钥、属性或脚本。

这是我的代码。我想复制 Release 文件夹中的 UpgradeScripts.sql 文件,安装后我想将其放入 ProgramFiles 的 ProgramFiles/Pharm/Database 文件夹中。

<CustomAction Id="CopyFileToInstalledProgramFiles" Directory="Database" BinaryKey="CustomActionUpgradeScriptsBinary" DllEntry="CustomAction" Execute="deferred" Impersonate="no" Return="check"/>
    <Binary Id="CustomActionUpgradeScriptsBinary" SourceFile="$(var.ReleaseFolder)\Database\UpgradeScripts.sql"/>
wix windows-installer custom-action file-copying
1个回答
0
投票

只需使用 File 元素来安装文件即可。 Windows Installer 擅长安装文件,比使用 CustomAction 更好。

© www.soinside.com 2019 - 2024. All rights reserved.