How do I detect that the installer is doing a repair?


You can check if the REINSTALL property is set. If you want to detect if a patch operation is happening (which also sets the REINSTALL property), you can check if the PATCH property is set (or the MsiPatchRemovalList property for patch uninstall).

Content credit belongs to

[Author: Robert Flaming]