1
votes

I'm using InstallShield and trying to execute a shell script (Custom Action) when my setup.exe is in Major upgrade mode. I'm kind of sure that the setup indeed runs in MAJOR UPGRADE mode as it first uninstalls the installed version and then installs the setup.exe version.

However, the action I added under Behavior and Logic doesn't happen... I set the Install UI Sequence as <First Action> and install UI Condition as IS_MAJOR_UPGRADE but nothing..

Where in the Sequence should I insert my custom action (after which sequence) if I want it to take place during major upgrade process and right at beginning of the uninstall (before the install of the updated version)?

Any ideas? What am I doing wrong?

1

1 Answers

4
votes

When a setup is uninstalled as part of a major upgrade it runs in silent mode. This means there is no GUI and the actions you have inserted in the InstallUISequence sequence will never run - in technical terms the whole InstallUISequence is skipped, and only the InstallExecuteSequence runs.

We need to know what your action is doing to provide correct advice. Is it making changes to the system, or is it just displaying information or requesting user input? If your custom action makes changes to the system it should be inserted in the InstallExecuteSequence and not in the InstallUISequence at all (no changes should be made to a system from the UI sequence). In other cases you should insert the custom action into both sequences - it all depends on what it is doing. Are you using Installshield Express btw?

Your condition of IS_MAJOR_UPGRADE should work, but you can also use UPGRADINGPRODUCTCODE which is the built-in condition in Windows Installer, the former is InstallShield's own, custom condition I believe. I would prefer the standard, Windows Installer property.

However, you should be aware that the condition UPGRADINGPRODUCTCODE is not true in the installing setup, only in the uninstalling setup. I believe IS_MAJOR_UPGRADE is valid in the installing setup, but not in the uninstalling setup. It could be set in both - I am not sure. See similar issue in the context of WiX.

For a convenient chart of custom action conditions please see this PDF from Flexera (makers of InstallShield): https://resources.flexera.com/web/pdf/archive/IS-CHS-Common-MSI-Conditions.pdf. I have not tested these conditions, please test thoroughly.

Erroneous conditioning which makes custom actions run at unexpected times is very common. Please analyze closely when the action should actually run. If it should run on every uninstall (regardless whether it is an uninstall initiated by a major upgrade or a manual uninstall), a better condition might be: REMOVE~="ALL" (valid for all uninstalls). Personally I like to add NOT PATCH to all my conditions to prevent all custom actions from running in patch mode (which I find is rarely desired). Try the linked chart above to help you decide on your conditioning.