0

I want to make backup of my application config files. This files are in specified directory. All i want to do is make subdirectory of this directory, and move there this config files on uninstall.

I know that this is possible with WiX custom action, but i think, that there is the simpler way.

I can do this scenario with CopyFile WIX element, but i don't know how to fire it at uninstalling only.

2 Answers2

1

A common way to do this is have the application make a copy of the config file when it first runs, and the copied file is updated and used by the application. The uninstall doesn't remove it (because it didn't install it) but it can be optionally removed with a RemoveFile element or a custom action (and removing with a CA is more straightforward than copying).

One of the reasons this technique is used is that individual config files might be required for each user. In these cases the template installed file is copied by the app to per user locations. Another reason is upgrades and patches. Careless patches and updates can overwrite the original file (because REINSTALLMODE=vamus is used). Also upgrades can be used to deliver updated config files without jumping through hoops figuring out how to preserve the existing config file and yet deliver the new one at install time - the older unchanged template config file can be replaced without impacting current app settings.

PhilDW
  • 20,260
  • 1
  • 18
  • 28
0

Here. Custom action which triggered only on ununstall.

<Custom Action='CREATE_BACKUP' Before='...'>REMOVE="ALL"</Custom>
Community
  • 1
  • 1
Arheus
  • 172
  • 7
  • Yes, i know this solution, but then i must write all logic to move this configs, add new project etc. instead of using CopyFile wix element. I'm trying to keep it as simple as it's possible. – AndrewGolota Jul 19 '16 at 14:03
  • CopyFile with Condition ? – Arheus Jul 19 '16 at 14:10