WiX CloseApplication 用于 exe 和 dll

发布于 2024-09-26 07:26:57 字数 651 浏览 6 评论 0原文

我根据文章 WiX 3 教程:了解主 WXS 和 WXI 文件 主要是因为它提供了执行应用程序关闭所需的 WiX。

然而,我对结果感到困惑。情况如下:

我们有一个使用 dll 的可执行文件,并创建一个安装可执行文件和 dll 的安装程序。我们执行设置。

案例 1:接下来,我们更改可执行文件而不是 dll,并再次创建安装程序。然后我们启动已安装的应用程序并确保 dll 也已加载。如果我们现在执行第二个设置,则会显示一个对话框,要求用户按照我们的预期关闭可执行文件。

情况2:但是,如果我们不更改应用程序,而只更改 dll,然后在应用程序运行并加载 dll 时执行安装程序,则不会显示任何对话框。安装结束时会出现一个对话框,询问我们是否要重新启动计算机。

这是预期的行为吗?当像案例 2 那样仅更改 dll 时,如何强制案例 1 的应用程序关闭对话框?我不希望用户必须重新启动计算机,因为应用程序正在无法重新启动的服务器上运行。

I've created a WiX setup project based on the article WiX 3 Tutorial: Understanding main WXS and WXI file mainly because it gives the WiX needed to do an application shutdown.

However, I'm puzzled by the outcome. Here's the situation:

We have an executable which uses a dll and create a setup which installs the executable and the dll. We execute the setup.

CASE 1: Next, we change the executable and NOT the dll and create the setup again. Then we start the installed application and make sure also the dll is loaded. If we now execute the second setup, a dialog is shown asking the user to shutdown the executable just as we expected.

CASE 2: But if we do not change the application but only the dll and then execute the setup while the application is running and the dll is loaded, no dialog is shown. At the end of the setup a dialog appears asking if we want to restart the computer.

Is this expected behaviour and how can I force the application shutdown dialog of CASE 1 also when only a dll is changed as in CASE 2? I do not want the user having to restart the computer because the application is running on a server which cannot be restarted.

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

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

发布评论

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

评论(2

鸠书 2024-10-03 07:26:57

这都是 Windows Installer 在成本计算过程中确定的。安装程序决定需要安装/更新哪些文件,并计算需要多少磁盘空间以及是否有任何文件锁定。如果存在文件锁,它会尝试将锁解析为具有窗口句柄的进程。如果它可以做到这一点,您将看到该对话框。如果不能,你就不会。这并不意味着不需要重新启动,它只是无法为您提供有关如何避免重新启动的有用信息。

其他几点:

确保您正在对 EXE 和 DLL 进行版本控制。如果旧的 DLL 是 1.0.0.0,新的 DLL 是 1.0.0.0,成本计算将显示“此处无需执行任何操作”。

EXE在运行时如何使用DLL?在进程的整个生命周期中,它可能根本没有锁定它。

了解 MSI 的重新启动行为可以通过使用 REBOOT=ReallySuppress 等属性来更改。

这里有一些值得阅读的好文章:

安装验证
FileInUseDialog
系统重新启动

This is all determined by Windows Installer during the costing process. The installer decides which files need to be installed / updated and calculates how much disk space is needed and if there are any file locks. If there are file locks, it attempts to resolve the lock to a process with a window handle. If it can do this, you'll get the dialog. If it can't, you won't. This doesn't mean a reboot won't be needed, it just can't give you useful information on how to avoid it.

A few additional points:

Make sure you are versioning your EXE and DLL. If the old DLL is 1.0.0.0 and the new DLL is 1.0.0.0 costing will say "Nothing to do here".

How does the EXE use the DLL at runtime? It might simply not have a lock on it during the entire life of the process.

Understand that MSI's reboot behavior can be altered through the use of properties such as REBOOT=ReallySuppress

Here's some good articles to read:

InstallValidate
FileInUseDialog
System Reboots

丶视觉 2024-10-03 07:26:57

我还没有检查代码,但我认为发生的情况是 CloseApplication 操作没有运行,因为它发现 exe 没有更改。据我所知,您不能使用 CloseApplication 来定位 DLL。如果您使用日志记录运行安装,您应该能够看到该操作是否被触发。我假设您在安装后期有RemoveExistingProducts计划,如果您要在InstallValidate之后移动它,它每次都会删除exe并因此触发该操作。

I haven't checked the code but I think what is happening is the CloseApplication action is not running because it sees that the exe hasn't changed. As far as I am aware you cannot target a DLL with CloseApplication. If you run your install with logging you should be able to see if the action is triggered. I am assuming you have RemoveExistingProducts schedule late in the install, if you were to move it after InstallValidate it would remove the exe every time and therefore trigger the action.

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