One registry key for many products not deleted on uninstall
Posted
by
NC1
on Stack Overflow
See other posts from Stack Overflow
or by NC1
Published on 2012-09-11T15:50:21Z
Indexed on
2012/09/12
15:38 UTC
Read the original article
Hit count: 234
My company has many products, we want to create a registry key Software\$(var.Manufacturer)
that will have all of our products if our customers have installed more than one (which is likely) I then want to have a secondary key for each of our products which get removed on uninstall but the main one does not. I have tried to achieve this like below but my main key gets deleted so all of my other products also get deleted from the registry. I know this is trivial but I cannot find an answer.
<DirectoryRef Id="TARGETDIR">
<Component Id="Registry" Guid="*" MultiInstance="yes" Permanent="yes">
<RegistryKey Root="HKLM" Key="Software\$(var.Manufacturer)" ForceCreateOnInstall="yes">
<RegistryValue Type="string" Name="Default" Value="true" KeyPath="yes"/>
</RegistryKey>
</Component>
</DirectoryRef>
<DirectoryRef Id="TARGETDIR">
<Component Id="RegistryEntries" Guid="*" MultiInstance="yes" >
<RegistryKey Root="HKLM" Key="Software\$(var.Manufacturer)\[PRODUCTNAME]" Action="createAndRemoveOnUninstall">
<RegistryValue Type="string" Name="Installed" Value="true" KeyPath="yes"/>
<RegistryValue Type="string" Name="ProductName" Value="[PRODUCTNAME]"/>
</RegistryKey>
</Component>
</DirectoryRef>
EDIT: I have got my registry keys to stay using the following code. However they only all delete wen all products are deleted, not one by one as they need to.
<DirectoryRef Id="TARGETDIR">
<Component Id="Registry" Guid="FF75CA48-27DE-430E-B78F-A1DC9468D699" Permanent="yes" Shared="yes" Win64="$(var.Win64)">
<RegistryKey Root="HKLM" Key="Software\$(var.Manufacturer)" ForceCreateOnInstall="yes">
<RegistryValue Type="string" Name="Default" Value="true" KeyPath="yes"/>
</RegistryKey>
</Component>
</DirectoryRef>
<DirectoryRef Id="TARGETDIR">
<Component Id="RegistryEntries" Guid="D94FA576-970F-4503-B6C6-BA6FBEF8A60A" Win64="$(var.Win64)" >
<RegistryKey Root="HKLM" Key="Software\$(var.Manufacturer)\[PRODUCTNAME]" ForceDeleteOnUninstall="yes">
<RegistryValue Type="string" Name="Installed" Value="true" KeyPath="yes"/>
<RegistryValue Type="string" Name="ProductName" Value="[PRODUCTNAME]"/>
</RegistryKey>
</Component>
</DirectoryRef>
© Stack Overflow or respective owner