PDA

View Full Version : How can InstallScript determine its running from a patch not a product install?



marc.gibian
05-16-2006, 03:01 PM
I have released multiple versions of a product using Basic MSI installers. Patches have been released through Quick Patch projects. I have run headon into a Quick Patch limitation whereby one can disable (prevent from running) a custom action during patch install, but the custom action is always executed during patch uninstall. Given the custom action in question tests the feature state of the features in the product and updates the registry accordingly, AND patches apparently do not set feature states, running the custom action from a patch install/uninstall causes the registry settings for the product to be trashed.

Does anyone know of InstallScript test(s) I can use in my custom action(s) to determine if its running from a patch or product install/uninstall, so I can avoid trashing my registry settings when run from a patch?

RobertDickau
05-16-2006, 05:06 PM
Can you test if the PATCH property is defined (with MsiEvaluateCondition or MsiGetProperty)?

marc.gibian
05-16-2006, 07:36 PM
I tried the PATCH property getting it with MsiGetProperty. This works fine during Patch install, but it has the same (null) value during patch uninstall. I have a lengthy conversation going with Installshield support. But, if I test MsiPatchRemovalList, I do get an indication of a patch being removed. SO, if I combine the two I appear to get what I'm looking for:

MsiGetProperty(hMSI, "MsiPatchRemovalList", removal, size);
MsiGetProperty(hMSI, "PATCH", patch, size);
if ((StrLength(removal) > 0) OR (StrLength(patch) > 0)) then
// I'm in a patch
endif;

Of course, right now I'm wishing I had done this in my InstallScript back when the product was initially released as I don't see how I would be able to upgrade my InstallScript via a patch? So, for all prior releases I would seem to be stuck, but at least I think I know how to fix this moving forward in our next release.