我试图防止我的服务在我的 WiX 安装程序的主要升级中丢失它们的设置(凭据和其他选项)。我遵循了这里的建议,我正在尝试使用
<InstallExecuteSequence>
<DeleteServices>NOT UPGRADINGPRODUCTCODE</DeleteServices>
</InstallExecuteSequence>
但是我的服务仍然会在升级时重新安装,每次升级都会丢失我的凭据和其他服务设置。
在日志中,我的条件似乎只被兑现了一次。我懂了
MSI (s) (6C:E8) [16:52:53:944]: Skipping action: DeleteServices (condition is false)
然后几百行后,我看到
MSI (s) (6C:A4) [16:52:54:873]: Doing action: DeleteServices
所以在我看来,第二个 DeleteServices 是我的问题。谁能告诉我如何抑制第二个,或者我正在做什么来导致它?
我正在使用 WiX 工具集 3.7。这是我的代码,显然已删除了 guid。
<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>
谢谢!