I want to assert that a certain registry value exists after installation, so I added the following component:
<Component Id="RegistryEntryContextMenuOdt" Guid="4BA5BA24-4F65-4BDF-99EB-CB4B947F31A9" DiskId="1" KeyPath="yes">
<RegistryKey Id="RegKeyOdt" Root="HKCR" Action="create" Key=".odt">
<RegistryValue Type="string" Value="openDocument.WriterDocument.1" />
</RegistryKey>
</Component>
The key/value might already be set before the installation. However, I want that the value is set to my specific value, i.e. that it will be overwritten with my value.
My problem is now that this value is always removed when my product is uninstalled. However, I only want the value to be removed if it was added by my installer. If my installer just modified the value, the previous value should be restored (or, if this is not possible, my value should remain untouched).
Please note that the key itself is not removed on uninstall. This seems to work correctly because I specified Action="create"
on the RegistryKey
element.
Is there maybe a similar setting for RegistryValue
which will create the value but not remove it on install?
UPDATE: Both registry keys under HKCR are machine wide settinge, i.e. they originate from the HKLM\SOFTWARE\Classes branch of the registry.