How do I make a custom action execute only during uninstall?
There is a predefined Windows Installer property called Installed, which is case sensitive. This property determines if the currently running MSI has been installed. If the MSI has been installed, this property would return true.
To get the custom action to run only during the uninstall this property would need to be true. To do this, place the Installed Property in the Condition field of the custom action, after the CostFinalize action within the MSI Script. (See the following sample code)
Display message (or any other custom action)