Search code examples
wixwindows-installer

Specify directories to not be removed on uninstall


I have a WiX installer for an app that can generate two folders while running. I'd like these two folders to not be removed on uninstall however. I'm using RemoveFolderEx to remove the entire install directory, but wasn't sure if there was a way to exclude folders from being removed.

I've tried using a Custom Action with a PowerShell script to move the folders out of the directory, but this solution would rely on the script being somewhere outside of the install directory in order to be run before the folders are removed, and doing this unfortunately gets rid of the installer's portability.


Solution

  • Have you tried setting the msidbComponentAttributesPermanent attribute on the required Component(s) to make them permanent?

    https://learn.microsoft.com/en-us/windows/win32/msi/component-table