Wix 重大升级:如何防止 Windows 服务重新安装? [英] Wix Major Upgrade: how do I prevent Windows service reinstallation?
问题描述
我正在开发一个应该安装多个 Windows 服务的安装程序.我们经常制作新版本(使用新的 .msi 文件),并且我们使用重大升级来简化以前安装的安装.
I'm working on an installer that is supposed to install several Windows services. We make new builds (with new .msi files) pretty often, and we use major upgrades to make it easy to install over a previous installation.
问题是我们需要在不覆盖服务配置(例如帐户用户名和密码)的情况下更新服务文件.
The problem is that we need to update the service files without overwriting the service configuration (account username and password, for instance).
我们在保存服务 exe
文件的组件中使用了 ServiceInstall
和 ServiceControl
.有没有办法让 ServiceInstall
有条件地执行(使用像 REMOVE="ALL" AND NOT UPGRADINGPRODUCTCODE
这样的条件),所以升级时不会卸载服务(刚刚停止所以我们可以升级文件)?
We're using ServiceInstall
and ServiceControl
inside the component that holds the service exe
file. Is there a way to make the execution of ServiceInstall
conditional (using a condition like REMOVE="ALL" AND NOT UPGRADINGPRODUCTCODE
) so the service is not uninstalled when upgrading (just stopped so we can upgrade the files)?
一种解决方案是使用自定义操作,但也许有更好的方法?
One solution would be to use custom actions, but maybe there is a better way?
谢谢!
推荐答案
看来我找错地方了.我的问题的解决方案是将 NOT UPGRADINGPRODUCTCODE
添加到 DeleteServices
标准操作.
It seems I was looking in the wrong place. The solution to my problem is to add the NOT UPGRADINGPRODUCTCODE
to the DeleteServices
standard action.
这解决了我的问题.这种方法的警告是删除(或不删除)当前 msi
文件安装的所有服务.所以我不能在升级时有选择地删除/保留服务.但是,这对我来说很好 - 我满足了在升级过程中保留服务登录信息(但不是实际服务代码)的要求.
This fixes my problem. The caveat of this approach is that all services installed by the current msi
file are deleted (or not). So I can't delete/keep services selectively on an upgrade. This is fine with me, however - my requirement of keeping the service logon information (but not the actual service code) across upgrades is fulfilled.
更新:DeleteServices
的条件可从 WiX 的 InstallExecuteSequence
元素中访问.
UPDATE: The condition for DeleteServices
is accessible from WiX in the InstallExecuteSequence
element.
这篇关于Wix 重大升级:如何防止 Windows 服务重新安装?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!