There might be cases when you need to backup specific file/folder during an upgrade.
To back up some files during an upgrade, you need to create a custom action. There will be two custom actions, first custom action will back up the config file before the old version being removed and another custom action that will restore the backuped files after the installation of the upgraded version.
An upgrade installation consists in two parts:
- the uninstall of the old product version
- the installation of the new product version
The second custom action that will restore the config files needs to be scheduled after the "Add Resources" action group, as you can see below: For example, you can create your custom action as a custom action written in C# or a custom action written in C++. Please take a look on the How to integrate and debug custom actions? article which may be useful to you.
If you will use the DTC C# approach, then you can take advantage of the Directory.Exists Method. You can also take a look on the How to backup and restore files/folders in APPDIR? thread which debates a similar issue.
Best regards,
Dan