Search code examples
c#.netvisual-studio-2010windows-installersetup-project

Setup/Deployment project: Prevent modified files from being removed when uninstalling


I have a setup project. If the user modifies one of the installed files and then un-installs the application, I'd like the file to NOT get deleted by the uninstall (so that when the user re-installs later, the modified file is used rather than the default one that the installer would normally use). Is this at all possible?

Note: Files which have not been edited should be applicable for upgrades/removal.


Solution

  • Since it is not possible to prevent the setup project from removing modified files when uninstalling, the best approach I have found (as mentioned by Ciprian) is to create a custom action which backs up the modified files before uninstallation, and restores them in another custom action afterwards.