我实现 wix 来生成一些 msi。我想维护 .bat 文件(打包在这个 wix 项目中)以包含一些要做的工作(并通过一些自定义操作激活)我在 VS2010 中将 .bet 添加到我的 wix 项目中。
我的问题是
- 我如何将它实际包装在目标机器上可以运行脚本的 msi 中?
- 我如何在自定义部分元素中实际引用该嵌入式批处理文件
我实现 wix 来生成一些 msi。我想维护 .bat 文件(打包在这个 wix 项目中)以包含一些要做的工作(并通过一些自定义操作激活)我在 VS2010 中将 .bet 添加到我的 wix 项目中。
我的问题是
这可能不是您正在寻找的答案,但我强烈建议您不要这样做。从 MSI 包中运行批处理文件有许多缺点,总有一天会打你:
相反,我鼓励您执行以下操作:
您正在寻找我认为是类型 18 的自定义操作:
The executable is generated from a file installed with the application. The
Source field of the CustomAction table contains a key to the File table. The
location of the custom action code is determined by the resolution of the target
path for this file; therefore this custom action must be called after the file
has been installed and before it is removed.
CustomAction 元素具有 ExeCommand 属性,仅适用于这种情况。它看起来像这样:
<CustomAction Id="ExecuteMyBatchFile"
FileKey="[#FileKey]"
ExeCommand="Arguments passed to batch file"
Execute="deferred"/>
当然,这是假设批处理文件是由 msi 安装的。