Wix 的 util:CloseApplication 扩展似乎不起作用

发布于 2024-09-04 17:12:33 字数 695 浏览 7 评论 0原文

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

根据 此论坛帖子,Wix 似乎已经过去关闭最小化的应用程序时遇到问题,所以我想知道这是否相关?

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

这是 CloseApplication 声明:

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

这是自定义操作:

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

I'm trying to close a process before uninstallation using Wix. I've confirmed that it works as long as there's a visible window, but if there isn't a visible window (which is the case most of the time with this app since it's a system tray app), the uninstaller just hangs, and eventually continues with the uninstallation, leaving the process running.

According to this forum post, it seems like Wix has had trouble closing minimized apps in the past, so I wonder if this is related?

Any suggestions as to what else I can do to make sure the process gets shut down? Is there any way I can try and capture the message in my app using the Win32 api maybe?

Here's the CloseApplication declaration:

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

And here's the custom action:

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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

用心笑 2024-09-11 17:12:33

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

修复可能非常简单。删除 Custom/@Action="WixCloseApplications" 元素。

It looks like you are scheduling the WixCloseApplications custom action before the installation transaction. The way the custom action works, is it scheduled a deferred action that actually closes the applications. It can't do that work unless it happens during the transaction (After="InstallInitialize").

The fix is probably pretty easy. Remove the Custom/@Action="WixCloseApplications" element.

屋顶上的小猫咪 2024-09-11 17:12:33

首先,不要忘记引用 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

At first, don't forget to reference WixUtilExtension.dll assembly.
Also check if Wix element contains definition of UtilExtension namespace:

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

I've noticed that you should change your custom action to be executed before InstallInitialize.

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

If you apply those changes and CloseApplications extension doesn't work, try logging installation process using

msiexec /i MyApplication.msi /l*v MyLogFile.txt
倦话 2024-09-11 17:12:33

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

<Custom Before="InstallValidate" Action="WixCloseApplications"/>

I also faced this problem.
Changing the Before attribute to "InstallValidate" worked for me.

<Custom Before="InstallValidate" Action="WixCloseApplications"/>
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文