在卸载期间提示用户关闭应用程序(在 WiX 中) [英] Prompt user to close application during uninstall (in WiX)

查看:29
本文介绍了在卸载期间提示用户关闭应用程序(在 WiX 中)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 Windows Installer XML 3.0 (WIX3) 安装一些软件.

I am using Windows Installer XML 3.0 (WIX3) to install some software.

一切正常,但是,我很难处理以下用例:安装的软件仍在运行,而用户尝试卸载 它.默认行为似乎删除了所有文件,但允许应用程序运行(在我的情况下很难看到,因为它位于任务托盘中).

Everything works fine, however, I'm having a really hard time to handle the following use case: the installed software is still running, when the user tries to uninstall it. The default behavior seems to remove all files but lets the application running (which is hard to see in my case, because it's sitting in the task tray).

我在 installer.wxs 文件中添加了以下代码:

I added the following code in my installer.wxs file:

<InstallExecuteSequence>
  <Custom Action="WixCloseApplications" Before="RemoveFiles" />
</InstallExecuteSequence>

<util:CloseApplication Id="CloseFoobar"
                       CloseMessage="no"
                       Description="FooBar is still running!"
                       ElevatedCloseMessage="no"
                       RebootPrompt="no"
                       Target="foobar.exe" />

但这不起作用 - 更糟糕的是,它会显示一个对话框,要求在安装期间重新启动!

But this doesn't work - even worse, it shows a dialog that asks for a reboot during install!

正确的做法是什么?

推荐答案

据我所知,在你的 UI 中添加以下引用应该足够了:

As far as I remember it should be enough to add the following references to your UI:

<DialogRef Id="FilesInUse" />
<DialogRef Id="MsiRMFilesInUse" />

CloseApplication 的东西只用于在安装过程中关闭应用程序,但它有问题(至少当我几个月前尝试过时,现在可能已经修复了?)

The CloseApplication stuff is only for closing applications during install, but it is buggy (at least when I tried it some months ago, maybe it's fixed now?)

不幸的是,这又是一个非常糟糕的 WiX 文档示例,甚至没有记录像这样的标准安装/卸载场景.

Unfortunately, this is again an example for the very poor documentation of WiX, not even standard install/uninstall scenarios like this one are documented.

这篇关于在卸载期间提示用户关闭应用程序(在 WiX 中)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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