问题描述
我正在尝试防止我的服务在 WiX 安装程序的主要升级中丢失其设置(凭据和其他选项).我遵循了建议 此处,我正在尝试使用
I'm trying to prevent my services from losing their settings (credentials and other options) on major upgrades in my WiX installer.I followed the advice here, and I'm trying to use
<InstallExecuteSequence>
<DeleteServices>NOT UPGRADINGPRODUCTCODE</DeleteServices>
</InstallExecuteSequence>
但我的服务仍在升级时重新安装,每次升级都会丢失我的凭据和其他服务设置.
But my services are still being reinstalled on upgrades, losing my credentials and other service settings on each upgrade.
在日志中,我的条件似乎只获得了一次.看到了
In the log, it looks like my condition is being honored only once. I see
MSI (s) (6C:E8) [16:52:53:944]: Skipping action: DeleteServices (condition is false)
然后几百行之后,我明白了
and then a few hundred lines later, I see
MSI (s) (6C:A4) [16:52:54:873]: Doing action: DeleteServices
所以在我看来,第二个 DeleteServices 是我的问题.谁能告诉我如何抑制第二个,或者我正在做什么导致它?
So it appears to me that the second DeleteServices is my problem. Can anyone tell me how I can suppress that second one, or what I'm doing to cause it?
我使用的是 WiX 工具集 3.7.这是我的代码,显然删除了 guid.
I'm using the WiX toolset 3.7.Here's my code, guids removed obviously.
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Product Id='*' Name='My Product' Language='1033'
Version='1.0.6' Manufacturer='Me' UpgradeCode='PUT-GUID-HERE' >
<Package Description='My Product' Platform='x86' Id='*'
Manufacturer='Me' InstallerVersion='200' Compressed='yes' />
<MajorUpgrade DowngradeErrorMessage="A later version of [ProductName] is already installed. Setup will now exit."/>
<InstallExecuteSequence>
<DeleteServices>NOT UPGRADINGPRODUCTCODE</DeleteServices>
</InstallExecuteSequence>
<Media Id='1' Cabinet='product.cab' EmbedCab='yes' />
<Directory Id='TARGETDIR' Name='SourceDir'>
<Directory Id='ProgramFilesFolder' Name='PFiles'>
<Directory Id='AgentDir' Name='Agent'>
<Component Id='Binaries' Guid='PUT-GUID-HERE' Win64='no'>
<File Id='AgentExe' Source='../MyProduct/MyExe.exe' KeyPath='yes' ProcessorArchitecture='x86' />
<ServiceInstall Id="TheServiceInstall" Description="[ProductName]" EraseDescription="no" DisplayName="[ProductName]" ErrorControl="normal" Interactive="no" Name="[ProductName]" Start="auto" Type="ownProcess" Vital="yes">
</ServiceInstall>
</Component>
</Directory>
</Directory>
</Directory>
<Feature Id='CompleteInstall' Title='My Product' Level='1'>
<ComponentRef Id='Binaries' />
</Feature>
</Product>
</Wix>
谢谢!
推荐答案
看来我的问题不是服务被删除,而是新产品的安装导致我丢失服务设置.
It seems that my problem was not that the services were being deleted, it was the install of the new product that was causing me to lose my service settings.
我将它添加到我的 InstallExecuteSequence 块中,它似乎成功了
I added this into my InstallExecuteSequence block, and it seems to have done the trick
<InstallServices>NOT WIX_UPGRADE_DETECTED</InstallServices>
感谢斯蒂芬的帮助!
这篇关于防止服务在 WiX 中的主要升级时丢失设置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!