Skylla
Posts: 17
Joined: Thu Jan 24, 2013 1:44 pm

Avoid file removal during upgrade

Hello

I've set up a custom File Removal under "File and Folders".

Remove on: "Component uninstall"
Condition: (REMOVE="ALL" AND (NOT UPGRADINGPRODUCTCODE))
Yet the file is removed during upgrade?

Under "Upgrades" i have selected "Uninstall old version first and then install new version"
Skylla
Posts: 17
Joined: Thu Jan 24, 2013 1:44 pm

Re: Avoid file removal during upgrade

Maybe i should add that I have:

Enhanced User Interface: Only on install
Eusebiu
Posts: 4931
Joined: Wed Nov 14, 2012 2:04 pm

Re: Avoid file removal during upgrade

Hi,

In order to preserve a file/folder during an upgrade you can follow the steps below:
- right click on the file/folder and select "Properties"
- go in the "Operations" tab
- check the "Do not overwrite existing file" radio button
- in the "Condition" text field write "OLDPRODUCTS"

In this case, during upgrade, that file will be backed up before the uninstallation of the old version and will be restored at the installation of the new version.

Best regards,
Eusebiu
Eusebiu Aria - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
Skylla
Posts: 17
Joined: Thu Jan 24, 2013 1:44 pm

Re: Avoid file removal during upgrade

The file is created through a custom action under InstallInitialize. So it is not available under "File and folders"

During install we have a custom action checking if the file exists already.
If the file already exists we skip a couple of dialogs and the file is not recreated (saves the user some questions during install).

I would like to keep the file during upgrades, but remove it during an uninstall.

But as I said the file is not available under "File and Folders" your solution is not viable
Eusebiu
Posts: 4931
Joined: Wed Nov 14, 2012 2:04 pm

Re: Avoid file removal during upgrade

Hi,

If your file is created by a custom action, it will not be removed during uninstallation or during upgrade because it will not be registered by Windows Installer.

In this case you need a "File Removal" operation exactly as you said in the first post of this thread. I tested that scenario and it works well to me.

Best regards,
Eusebiu
Eusebiu Aria - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Building Installers”