Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/wix/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Installation 使用自定义操作在WiX中运行复制的文件_Installation_Wix_Windows Installer_Wix3 - Fatal编程技术网

Installation 使用自定义操作在WiX中运行复制的文件

Installation 使用自定义操作在WiX中运行复制的文件,installation,wix,windows-installer,wix3,Installation,Wix,Windows Installer,Wix3,我正在使用WiX创建一个安装程序,我有一个*.bat文件,我正在将它复制到%temp%下的SomeFolder2(类似于下面的代码片段…) 然后在安装顺序中: <InstallExecuteSequence> <Custom Action="SetPath" After="{some standard MS action}">NOT REMOVE="ALL"</Custom> <Custom Action="StartAction" B

我正在使用WiX创建一个安装程序,我有一个*.bat文件,我正在将它复制到
%temp%
下的SomeFolder2(类似于下面的代码片段…)

然后在安装顺序中:

<InstallExecuteSequence>
    <Custom Action="SetPath" After="{some standard MS action}">NOT REMOVE="ALL"</Custom>
    <Custom Action="StartAction" Before="{some other action}">NOT REMOVE="ALL"</Custom>
    ...
</InstallExecuteSequence>

不删除=“全部”
不删除=“全部”
...
我已经将SetPath设置为在各种标准操作(例如PublishProduct)之后运行,而StartAction将在另一个自定义操作之前运行

当我运行MSI文件时,我会查看日志,路径设置正确。但是,在运行StartAction时,出现以下错误:

返回值1631

根据文档,这将转换为“错误\u创建\u失败”(Windows Installer服务无法启动。请与您的技术支持人员联系)。问题是,文件确实被复制到
%TEMP%\SomeFolder2
(在设置路径和实际执行之前,我可以添加…),但由于某些原因,它根本不执行(如果您手动或通过命令提示符或其他方式执行它,它确实会正常执行)


我试着将同一个文件放在程序的
ProgramFiles\Some\u目录下。同样的事情也会发生;它会被复制到那里,但不会执行。为什么会发生这种情况?

首先,只要您想在自定义操作中使用软件包安装的文件,就应该使用它。也就是说,示例中的StartAction CA必须延迟。此外,当需要从CA运行可执行文件时,我尝试使用

我希望这有帮助

<CustomAction Id="SetPath" Property="ThePath" Value="[DESTDIR]\mybat.bat" />
<CustomAction Id="StartAction" Property="ThePath" ExeCommand="" Return="asyncNoWait" />
<InstallExecuteSequence>
    <Custom Action="SetPath" After="{some standard MS action}">NOT REMOVE="ALL"</Custom>
    <Custom Action="StartAction" Before="{some other action}">NOT REMOVE="ALL"</Custom>
    ...
</InstallExecuteSequence>