Common setup mistake (please do not remove generated content on upgrade)

By default, Windows Installer never deletes files it doesn’t know of (user files, generated by setup custom action files).

There are big temptation to write uninstall custom action which deletes all files to make directory clear after product deletion.

Please think about upgrade even you working on the first version of your product.

<Custom Action=”REMOVEDIRS” Before=” InstallFinalize”>REMOVE=”ALL”</Custom> – Incorrect (the product customization will be deleted on uninstall and upgrade)

<Custom Action=”REMOVEDIRS” Before=” InstallFinalize”>REMOVE=”ALL” AND NOT UPGRADINGPRODUCTCODE</Custom> – Correct (the product customization will be deleted on uninstall only. The user files and generated files will be available after upgrade).