cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
cork_crawbaugh
Level 2

Custom Actions Not Executing in UPDATE

I have several custom actions that execute correctly during a first install. Each calls an InstallScript function that checks a condition and sets a property.

These do not seem to execute if the installer detects that it shoud be an update. ???

They are all marked for Immediate Execution and exist in the Install UI Sequence.

Something I'm missing ??

Thanks.

PS - this is an InstallScript MSI project implemented with 2012
Labels (1)
0 Kudos
(3) Replies
ilirqt
Level 4

What do you have as Install (UI/Exec) Condition for those Custom Actions?

You can try to set the condition to 1 so they will be always executed whether is install, repair, modify, upgrade, etc.
0 Kudos
cork_crawbaugh
Level 2

Thanks for the suggestion. I set the condition to 1, but the behavior does not change.
0 Kudos
joshstechnij
Level 10 Flexeran
Level 10 Flexeran

This is a limitation imposed by Windows Installer due to the architecture of InstallScript MSI projects. In an InstallScript MSI project, the InstallScript engine manually opens the MSI package to run the UI sequence through calling the MsiDoAction API for any actions that could normally run (because InstallScript serves as an external UI handler to the MSI package being installed, UI sequence actions would normally never run). In order to accomplish this through MSI APIs when the product is already installed and the package code has changed (i.e. running an upgrade) the InstallScript engine passes the MSIOPENPACKAGEFLAGS_IGNOREMACHINESTATE to the MsiOpenPackageEx API to avoid an error in opening the package normally. Per the MsiOpenPackageEx documentation:

Note that if dwOptions is MSIOPENPACKAGEFLAGS_IGNOREMACHINESTATE or 1, MsiOpenPackageEx ignores the current machine state when creating the product handle.
...
The restricted handle created by using MsiOpenPackageEx with MSIOPENPACKAGEFLAGS_IGNOREMACHINESTATE only permits execution of dialogs, a subset of the standard actions, and custom actions that set properties ( Custom Action Type 35, Custom Action Type 51, and Custom Action Type 19). The restricted handle prevents the use of custom actions that run Dynamic-Link Libraries, Executable Files or Scripts.


Since InstallScript custom actions are launched from a DLL, these actions will not run in situations where the product code does not change but the package code does change (small updates, minor upgrades) if sequenced in the UI sequence.

In order to get this script code to run during all scenarios, it should be moved to a script event (such as OnBegin) or the custom action should be sequenced in the install execute sequence.
0 Kudos