我正在尝试阻止我的服务在我的WiX安装程序中的主要升级中丢失其设置(凭据和其他选项)。 我遵循了建议here,我正在尝试使用
<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>
谢谢!
答案 0 :(得分:8)
似乎我的问题不是服务被删除,而是新产品的安装导致我丢失了我的服务设置。
我将它添加到我的InstallExecuteSequence块中,似乎已经完成了这个技巧
<InstallServices>NOT WIX_UPGRADE_DETECTED</InstallServices>
感谢Stephen的帮助!
答案 1 :(得分:1)
在重大升级中,请记住您将运行两个执行序列,一个用于卸载旧产品,另一个用于安装新产品。我怀疑你的问题来自旧产品的卸载。旧产品是否具有“... AND NOT UPGRADINGPRODUCTCODE”条件以在卸载旧产品时禁止DeleteServices操作?在尝试升级之前,您必须找到一种方法来修补旧产品以插入该条件。