使用Wix安装程序(win 8),我有一个自定义操作,使用Wix成功安装后运行应用程序:
<CustomAction Id='LaunchFile'
Directory='TARGETDIR'
Impersonate="no"
Execute="immediate"
ExeCommand='[SystemFolder]cmd.exe start CMD /c ""[TARGETDIR]ManagerAndControl.exe""'
Return="asyncNoWait" />
这很好用,但由于某种原因,CMD窗口仍然打开,当应用程序关闭时它也会关闭。
我在谷歌找不到类似的东西,有人遇到过类似的问题吗?
谢谢
编辑:
正如@Rolo建议的那样,我尝试了QtExecCmdLine:
<Property Id="QtExecCmdLine" Value='C:\Users\User\Desktop\tests.exe'/>
<CustomAction Id="QtExecExample" BinaryKey="WixCA" DllEntry="CAQuietExec" Execute="immediate" Return="check"/>
还有:
<Publish Event='DoAction' Value='QtExecExample'>(NOT Installed) AND (LAUNCHPRODUCT = 1)
</Publish>
但没有任何反应,日志说:
Action start 11:02:49: QtExecExample.
MSI (c) (E0:20) [11:02:49:911]: Invoking remote custom action. DLL: C:\Users\User\AppData\Local\Temp\MSIAD42.tmp, Entrypoint: CAQuietExec
MSI (c) (E0:EC) [11:02:49:913]: Cloaking enabled.
MSI (c) (E0:EC) [11:02:49:913]: Attempting to enable all disabled privileges before calling Install on Server
MSI (c) (E0:EC) [11:02:49:913]: Connected to service for CA interface.
MSI (c) (E0!00) [11:02:49:944]: PROPERTY CHANGE: Deleting QtExecCmdLine property. Its current value is 'C:\Users\User\Desktop\tests.exe'.
Action ended 11:02:49: QtExecExample. Return value 3.
DEBUG: Error 2896: Executing action QtExecExample failed.
The installer has encountered an unexpected error installing this package. This may indicate a problem with this package. The error code is 2896. The arguments are: QtExecExample, ,
Action ended 11:02:49: FinishedForm. Return value 3.
Action ended 11:02:49: INSTALL. Return value 1.
填写丢失在这里
答案 0 :(得分:5)
改为使用“安静的执行自定义操作”。
http://wixtoolset.org/documentation/manual/v3/customactions/qtexec.html
更新
我必须更新我的答案。您应该使用WixShellExec自定义操作。它与Quiet Execution CA非常相似,但它允许您启动应用程序而无需等待它关闭。
但它只能用作立即自定义操作。
这里有一个完整的实施示例:
http://wixtoolset.org/documentation/manual/v3/customactions/shellexec.html
答案 1 :(得分:1)
像这样编辑你的execommand
> ExeCommand='[SystemFolder]cmd.exe start CMD /c ""[TARGETDIR]ManagerAndControl.exe"" & exit'
修改强>
> ExeCommand='"[TARGETDIR]ManagerAndControl.exe"'
我刚刚尝试过这个,并且在我重新创建原始问题之后它已经工作了。但是,如果你有[TARGETDIR],我使用[安装] - 我认为这是引用你的安装目录。你需要知道你使用引号。
答案 2 :(得分:1)
感谢您的帮助,最后我解决了它:
<Property Id="WixShellExecTarget" Value='[TARGETDIR]ManagerAndControl.exe' />
<CustomAction Id="LaunchApplication" BinaryKey="WixCA" DllEntry="WixShellExec" Impersonate="yes" />
<!-- UI code here -->
<Publish Event='DoAction' Value='LaunchApplication'>(NOT Installed) AND (LAUNCHPRODUCT = 1)</Publish>