WiX <util:CloseApplication>元素不工作 [英] WiX <util:CloseApplication> element not working

查看:21
本文介绍了WiX <util:CloseApplication>元素不工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在运行 WiX 捆绑安装.如果运行,MSI 包之一应关闭应用程序:

I am running a WiX bundle installation. One of the MSI packages should close the application if running:

<util:CloseApplication Id="CloseApplication" Target="My App.exe">1</util:CloseApplication>

这是在 元素之前的 元素中.我添加了 1 以确保条件为真.

This is in the <Product> element before the <Feature> element. I added the 1 to make sure the condition was true.

MSI 日志有这样的说法:

The MSI log has this to say:

MSI (s) (14:94) [21:30:13:979]: Doing action: WixCloseApplications
Action ended 21:30:13: CreateFolders. Return value 1.
MSI (s) (14:68) [21:30:13:993]: Invoking remote custom action. DLL: C:\Windows\Installer\MSI5D24.tmp, Entrypoint: WixCloseApplications
MSI (s) (14!CC) [21:30:14:023]: PROPERTY CHANGE: Adding WixCloseApplicationsDeferred property. Its value is 'My App.exe2'.
Action start 21:30:13: WixCloseApplications.
MSI (s) (14!CC) [21:30:14:023]: Doing action: WixCloseApplicationsDeferred
Action start 21:30:14: WixCloseApplicationsDeferred.
Action ended 21:30:14: WixCloseApplicationsDeferred. Return value 1.
MSI (s) (14:94) [21:30:14:052]: Doing action: InstallFiles
Action ended 21:30:14: WixCloseApplications. Return value 1.
Action start 21:30:14: InstallFiles.

如果我像这样将提示设置为否":

If I set prompts to 'no' like this:

<util:CloseApplication Id="CloseApplication" Description="Closing running application" Target="My App.exe" RebootPrompt="no" ElevatedCloseMessage="no" CloseMessage="no">1</util:CloseApplication>

日志是这样写的:

MSI (s) (50:04) [21:43:40:214]: Doing action: WixCloseApplications
Action ended 21:43:40: CreateFolders. Return value 1.
MSI (s) (50:14) [21:43:40:238]: Invoking remote custom action. DLL: C:\Windows\Installer\MSIFFA9.tmp, Entrypoint: WixCloseApplications
Action start 21:43:40: WixCloseApplications.
MSI (s) (50:04) [21:43:40:333]: Doing action: InstallFiles
Action ended 21:43:40: WixCloseApplications. Return value 1.
Action start 21:43:40: InstallFiles.

安装完成但原始应用仍在运行并且不会被关闭.

Either way the installation completes but the original app is still running and doesn't get shut down.

有问题的应用程序是一个 WPF 应用程序,我有 <MajorUpgrade Schedule="afterInstallExecute" ... 并且安装程序使用从 WiXBA 修改的托管 boostrapper 运行.

The application in question is a WPF app, I have <MajorUpgrade Schedule="afterInstallExecute" ... and the installer is run using a managed boostrapper modified from WiXBA.

推荐答案

我也无法让 CloseApplication 工作,我并没有为此付出太多努力,但我正在使用不同的方法来关闭应用程序taskkill 和 QtExec 像这样:

I also couldn't get CloseApplication to work and i didn't put too much effort on it but i'm using a different approach to close an app using taskkill and QtExec like this:

<Property Id="QtExecCmdLine" Value='"[WindowsFolder]\System32\taskkill.exe" /F /IM APP.EXE'/>
<CustomAction Id="APP.TaskClose" BinaryKey="WixCA" DllEntry="CAQuietExec" Execute="immediate" Return="ignore"/>

<InstallExecuteSequence>
  <Custom Action="APP.TaskClose" After="InstallInitialize"/>
</InstallExecuteSequence>

注意这是立即 CA,要运行它延迟,请查看wix文档:http://wixtoolset.org/documentation/manual/v3/customactions/qtexec.html

Note this is immediate CA, to run it deffered please take a look at wix documentation: http://wixtoolset.org/documentation/manual/v3/customactions/qtexec.html

这篇关于WiX &lt;util:CloseApplication&gt;元素不工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆