We are using WiX 3.5 to build an installer for one of our products. For simplicity, we handle version upgrades via a major upgrade, like so:
<MajorUpgrade AllowSameVersionUpgrades="yes" DowngradeErrorMessage="Laterversionfound" />
We are not specifying the Schedule attribute, which means the RemoveExistingProducts action should run after "InstallValidate" - meaning a full uninstall of the old version will take place, before installing the new version.
We install some HKLM registry settings, which the user must configure following installation. Because the major upgrade performs a full uninstall followed by a reinstall, we are losing the user-defined settings in the registry. Ideally, we need to be able to keep these across upgrades.
My registry key components look like this:
<Component Id="regserver" Guid="[guid]">
<RegistryValue Root="HKLM" Key="Software\Our Company\Our Product" Name="Server" Value="" Type="string" KeyPath="yes" />
</Component>
I've tried setting the NeverOverwrite property of the components to "yes" but this has the unfortunate effect of failing to recreate the keys - presumably because it checks to see if the keys exist before the uninstall happens (which obviously they do), then they get removed with the uninstall, but not recreated again.
I've also tried setting the "RemoveFeatures" attribute on the MajorUpgrade element to remove everything but the reg keys. This leaves two versions of the product installed though, as the feature containing the reg keys belongs to the old version.
My next step is to try scheduling the RemoveExistingProducts option at a different point, although i'm expecting a certain amount of pain with some of our custom actions.
So my question is, is there any way to achieve what we need, without changing where RemoveExistingProducts is scheduled?
Use RegistrySearch to load the current values into properties then use [PROPERTY] in RegistryValue to write those values. If there isn't an older product installed, the properties will keep their default values.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With