I am currently maintaining a piece of software that has loads of user defined registry keys. I'm trying to make a WIX installer that keeps these registry keys in tacted with the least amount of maintainability. I decided to make each value inside a registry key it's own component to allow me to use the NeverOverwrite='yes' feature of WIX. I assumed the existence of this would allow minor upgrades (ex. REINSTALL=ALL REINSTALLMODE=vomus) to create the value if it exists otherwise leave it alone. However this doesn't seem to be happening in my realworld example (No conditions on the feature) . The documentation is telling me I should be good. Here is a few samples:
<Product Id="UNIQUE_KEY" Name="Spotbox Manager" Language="1033" Version="1.0.1.0" Manufacturer="Company" UpgradeCode="MY_UPGRADE_KEY">
<Package Platform="x64" Id="*" InstallerVersion="200" Compressed="yes" InstallScope="perMachine" InstallPrivileges="elevated" />
<Upgrade Id="MY_UPGRADE_KEY">
<UpgradeVersion OnlyDetect='yes' Property='SELFFOUND'
Minimum='1.0.1' IncludeMinimum='yes'
Maximum='1.0.1' IncludeMaximum='yes' />
<UpgradeVersion OnlyDetect='yes' Property='NEWERFOUND'
Minimum='1.0.1' IncludeMinimum='no' />
</Upgrade>
This is the actual Fragments for the Registry Keys
<Component Id="cmp171812fcc51a4b91ad386fa8c27c9b89" Directory="TARGETDIR" Guid="COMPONENT_GUID" Win64='yes' NeverOverwrite='yes'>
<RegistryKey Key="SOFTWARE\Company" Root="HKLM">
<RegistryValue Name="Value" Value="1100797834" Type="integer" KeyPath='yes'/>
</RegistryKey>
</Component>
<Component Id="cmp211639bff9694f029028a22cb0bb9687" Directory="TARGETDIR" Guid="NEW COMPONENT GUID" Win64='yes' NeverOverwrite='yes'>
<RegistryKey Key="SOFTWARE\Company" Root="HKLM">
<RegistryValue Name="Country Code" Value="1" Type="integer" KeyPath='yes' />
</RegistryKey>
</Component> ...
Please Note: The Key is the same for both values This still seems to blow away the user's value when I try and change it.
First, there is no problem with having multiple values under the same registry key, and using them as separate keypaths. The term "keypath" has nothing to do with registry terminology, and in case of registry, it actually must identify a value and not a key.
Second, your comments mention that product uninstallation does not happen during a minor upgrade. This is correct on product level, but not on component level.
You should check that you have not changed the GUID or keypath of the misbehaving component between the old and the new version of your product - if you did, you clearly broke the rules for a minor upgrade (component removal). However, read on even if your GUIDs are stable, I have a more generic explanation for you.
Minor update is a reinstall. I am imagining the following order of events.
NeverOverwrite
being enabled). Permanent
being disabled in the old package. You have at least these options for correction, pick one.
Permanent
in addition to NeverOverwrite
, assuming you can do so in all releases; basically, that you did not release anything definitive yet. Most people keep these attributes in sync so why not follow the crowd and have fewer issues. Mess with the order of actions. Example:
<RemoveExistingProducts After="InstallValidate"/>
This last option will make your upgrade slower, but that is probably necessary if you really want minor upgrades and take advantage of NeverOverwrite
without Permanent
.
I found the issue it was a user error I had so many values in the registry that I didn't notice another section that was similar but without the component elements (Old configuration). After I removed it everything worked as expected. Thanks for the help guys.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.