6

我正在尝试在使用 Wix 卸载之前关闭一个进程。我已经确认只要有一个可见窗口它就可以工作,但是如果没有一个可见窗口(这个应用程序大部分时间都是这种情况,因为它是一个系统托盘应用程序),卸载程序就会挂起,并且最终继续卸载,使进程继续运行。

根据这个论坛帖子,Wix 过去似乎无法关闭最小化的应用程序,所以我想知道这是否相关?

关于我还能做些什么来确保进程被关闭的任何建议?有什么方法可以尝试使用 Win32 api 在我的应用程序中捕获消息?

这是 CloseApplication 声明:

<util:CloseApplication Id="CloseApp" CloseMessage="yes" Target="App.exe" RebootPrompt="yes" />

这是自定义操作:

<Custom Before="InstallInitialize" Action="WixCloseApplications">REMOVE = "ALL"</Custom>
4

3 回答 3

5

看起来您是WixCloseApplications在安装事务之前安排自定义操作。自定义操作的工作方式是安排实际关闭应用程序的延迟操作。除非它发生在事务 ( ) 期间,否则它无法完成这项工作After="InstallInitialize"

修复可能很容易。移除Custom/@Action="WixCloseApplications"元素。

于 2011-02-14T22:51:14.043 回答
2

首先,不要忘记引用WixUtilExtension.dll程序集。还要检查Wix元素是否包含UtilExtension命名空间的定义:

<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi" xmlns:util="http://schemas.microsoft.com/wix/UtilExtension">

我注意到您应该更改要在 InstallInitialize 之前执行的自定义操作。

<Custom Before="InstallInitialize" Action="WixCloseApplications">REMOVE = "ALL"</Custom>

如果您应用这些更改并且 CloseApplications 扩展不起作用,请尝试使用记录安装过程

msiexec /i MyApplication.msi /l*v MyLogFile.txt
于 2015-09-25T12:28:53.540 回答
0

我也遇到过这个问题。将 Before 属性更改为“InstallValidate”对我有用。

<Custom Before="InstallValidate" Action="WixCloseApplications"/>
于 2017-01-30T14:54:02.637 回答