Cmd 使用“if exist”在Wix中执行CustomAction
您好,我想在安装程序时执行以下自定义操作:Cmd 使用“if exist”在Wix中执行CustomAction,cmd,wix,xcopy,Cmd,Wix,Xcopy,您好,我想在安装程序时执行以下自定义操作: <!--Include the custom action for overwrite Client.config--> <CustomAction Id="SetCmdLineParams" Property="QtExecCA" Value='if exist "[CURRENTDIRECTORY]\Client.config" ("xcopy" /Y "[CURREN
<!--Include the custom action for overwrite Client.config-->
<CustomAction Id="SetCmdLineParams" Property="QtExecCA" Value='if exist "[CURRENTDIRECTORY]\Client.config" ("xcopy" /Y "[CURRENTDIRECTORY]\Client.config" "[INSTALLFOLDER]")' Execute="immediate" />
<CustomAction Id="QtExecCA" BinaryKey="WixCA" DllEntry="CAQuietExec" Execute="deferred" Return="check" Impersonate="no"/>
<!--Include the InstallExecuteSequence for overwrite Client.config-->
<InstallExecuteSequence>
<Custom Action="SetCmdLineParams" After="CostFinalize"/>
<Custom Action="QtExecCA" Before="InstallFinalize" />
</InstallExecuteSequence>
不幸的是,这不起作用,因为:CAQuietExec:命令字符串必须以带引号的应用程序名称开头
但是如果我引用if exist,那么该命令就不起作用。现在我能做什么?如果存在是cmd.exe的一项功能。您需要先说cmd/c,或者创建一个.bat文件并调用它 老实说,这是非常脆弱的代码。首先,CURRENTDIR并不总是你想象的那样。您应该编写C++或C自定义操作,使用原始数据库属性来获得MSI正在运行的位置,并从那里复制配置文件。 我在过去非常成功地使用的另一种方法是编写一个实用程序,通过将用户提供的配置文件嵌入其中来转换种子MSI。现在,部署故事被简化了