Rohit
Rohit

Reputation: 3638

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.

Upvotes: 10

Views: 6401

Answers (1)

selbie
selbie

Reputation: 104494

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.

Upvotes: 23

Related Questions