Does Uninstall action run during product upgrade?

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.


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.

链接地址: http://www.djcxy.com/p/20362.html

上一篇: 如何正确实现C ++中的工厂方法模式

下一篇: 产品升级过程中卸载操作是否运行?