WiX 计划重启条件

发布于 2024-09-29 10:10:05 字数 1029 浏览 0 评论 0原文

我试图让以下内容起作用:

在第一次安装程序时,它会修改系统的环境变量,因此您必须重新启动才能使程序完全运行。在 WiX 中执行此操作相当简单,您只需安排重新启动:

<InstallExecuteSequence>
    <ScheduleReboot After="InstallFinalize" />
</InstallExecuteSequence>

我遇到的问题是我希望能够对此程序进行较小的升级(版本号发生变化但产品 GUID 没有变化的升级),这确实不需要重新启动。

在我尝试让有条件重新启动工作时,我尝试这样做:

<Product 
    ... 
    Version="1.0.1" 
    UpgradeCode="MYUPDATEGUID-C39B-4DDE-BA5B-6113463F60C2" 
    ...
    >

<Upgrade Id="MYUPDATEGUID-C39B-4DDE-BA5B-6113463F60C2">
    <UpgradeVersion OnlyDetect="yes" Property="UPGRADING"
                    Maximum="1.0.1" IncludeMaximum="yes" />
</Upgrade>

...

<InstallExecuteSequence>
    <ScheduleReboot After="InstallFinalize">NOT UPGRADING</ScheduleReboot>
</InstallExecuteSequence>

这很棒,但它不起作用。无论我做什么,它总是尝试安排重新启动。

问题似乎出在属性 UPGRADING 上 - 如果我将 NOT UPGRADING 替换为 UPGRADING,它永远不会请求重新启动。

任何比我更有经验的人的任何见解都会很棒。

I am trying to get the following to work:

On the first installation of a program, it modifies the environment variables of the system, and therefore you must restart in order for the program to fully work. Doing this in WiX is fairly straight forward, you just schedule a reboot:

<InstallExecuteSequence>
    <ScheduleReboot After="InstallFinalize" />
</InstallExecuteSequence>

The problem I am having is I want to be able to do minor upgrades to this program (ones where the version number changes but the Product GUID does not) and this does not require a reboot.

In my attempts to get conditional rebooting working, I have tried to do is this:

<Product 
    ... 
    Version="1.0.1" 
    UpgradeCode="MYUPDATEGUID-C39B-4DDE-BA5B-6113463F60C2" 
    ...
    >

<Upgrade Id="MYUPDATEGUID-C39B-4DDE-BA5B-6113463F60C2">
    <UpgradeVersion OnlyDetect="yes" Property="UPGRADING"
                    Maximum="1.0.1" IncludeMaximum="yes" />
</Upgrade>

...

<InstallExecuteSequence>
    <ScheduleReboot After="InstallFinalize">NOT UPGRADING</ScheduleReboot>
</InstallExecuteSequence>

This is great, except it doesn't work. No matter what I do, it always tries to schedule a reboot.

It seems like the problem is the property UPGRADING--if I replace NOT UPGRADING with UPGRADING, it never requests a reboot.

Any insight from anyone more experienced than I am would be awesome.

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

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

发布评论

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

评论(1

孤檠 2024-10-06 10:10:05

我想更多地了解您最初的假设,即您需要重新启动。 WriteEnvironmentStrings 将广播 WM_SETTINGSCHANGE,正确编写的应用程序应该尊重它。除了像 Win 95 / 98 这样的边缘情况以及服务控制管理器设计不佳并且忽略这些消息这一事实之外,我认为通常您不应该首先需要重新启动。

否则,如果您正在进行较小的升级,请考虑使用“未安装”属性。这将使其在后续维修、维护、删除、小升级和补丁期间无法运行。

WriteEnvironmentStrings 操作

I'm wondering more about your initial assumption that you need to reboot. WriteEnvironmentStrings will broadcast a WM_SETTINGSCHANGE and properly written applications should respect it. Short of edge cases like Win 95 / 98 and the fact that the Service Control Manager is poorly designed and ignores these messages, I would think generally you shouldn't need the reboot in the first place.

Otherwise, if you are doing minor upgrades, consider using the property Not Installed. This will keep it from running during subsequent repairs, maintenance, removal, minor upgrades and patches.

WriteEnvironmentStrings Action

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