Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to prevent Wix from removing registry entries on uninstall?

 <RegistryKey Id="MyServerRegInstallDir" Root="HKLM" Key="Software\MyApp\Server" Action="create">
     <RegistryValue Name="InstallDir" Type="string" Value="[INSTALLDIR]" />
     <RegistryValue Name="DataDirectory" Type="string" Value="[MYAPPDATADIR]" />
  </RegistryKey>

The subkeys InstallDir and DataDirectory is deleted on uninstall. How do I prevent it?

Ideally Action="create" must do it.

like image 689
Rohit Avatar asked Jun 27 '10 01:06

Rohit


1 Answers

Set the Permanent="yes" attribute on the parent component.

http://wix.sourceforge.net/manual-wix3/wix_xsd_component.htm

Permanent YesNoType

If this attribute is set to 'yes', the installer does not remove the component during an uninstall. The installer registers an extra system client for the component in the Windows Installer registry settings (which basically just means that at least one product is always referencing this component). Note that this option differs from the behavior of not setting a guid because although the component is permanent, it is still patchable (because Windows Installer still tracks it), it's just not uninstallable.

like image 50
selbie Avatar answered Nov 09 '22 16:11

selbie