3

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.

Jeb
  • 3,689
  • 5
  • 28
  • 45

2 Answers2

1

To prevent uninstall you should mark the files' component as Permanent

http://msdn.microsoft.com/en-us/library/windows/desktop/aa368007(v=vs.85).aspx

Ciprian
  • 3,533
  • 1
  • 18
  • 22
  • I think they don't want to leave things installed - they just want to leave any user customizations instead of blowing them away. – Merlyn Morgan-Graham Nov 07 '11 at 12:09
  • That's correct. Files which have not been edited should be applicable for upgrades/removal. – Jeb Nov 07 '11 at 12:56
  • 1
    You should use then some custom actions to back-up the files before the RemoveFiles action and restore then afterwords. – Ciprian Nov 07 '11 at 13:03
  • Thanks, I was trying to avoid custom actions but there doesn't seem to be any other way. – Jeb Nov 09 '11 at 16:45
0

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.

Jeb
  • 3,689
  • 5
  • 28
  • 45