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
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?
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>
Thanks!
In a major upgrade remember you will run two execute sequences, one to uninstall the old product and another to install the new product. I suspect your problem comes from the uninstall of the older product. Does the older product have the "... AND not UPGRADINGPRODUCTCODE" condition to suppress the DeleteServices action when the old product is uninstalled? You will have to find a way to patch the old product to insert that condition before you attempt the upgrade.
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.
I added this into my InstallExecuteSequence block, and it seems to have done the trick
Thank you for the help Stephen!