Does Uninstall action run during product upgrade?

63 Views Asked by At

I want to add a custom action to my visual studio installer project to delete some files that are created by my app during runtime. These files are dynamically created and not deleted as part of the normal uninstall.

My question is: what happens when you upgrade or update the application by installing a newer version? Does the installer run the Uninstall custom action?

I do have RemovePreviousVersions set to True in the deployment project properties. I'd actually like to delete the files only if it's a true removal not an upgrade.

1

There are 1 best solutions below

0
On

RemovePreviousVersions will perform an uninstall. If I understand your question correctly, you have files that are created after the application has been installed and you wish these to be removed when the product is uninstalled and not during upgrades. I do not have experience with the VS installer types, but look for something that gives you access to the RemoveFile table. https://msdn.microsoft.com/en-us/library/windows/desktop/aa371201(v=vs.85).aspx

If the vs installer doesn't expose the RemoveFile table you may need to look into InstallShield 2016/2017 Pro or Premium. If you are really adventurous then look at WIX.