cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
roger_hurst
Level 5

passing properties between immediate execution CA's

I have an immediate customaction that must execute after UI ExecuteAction that requires the value of INSTALLDIR.

I've created MyInstallDir installscript function and interted it after CostFinalize. It calls MsiSetProperty(hMSI, "INSTALLDIR", INSTALLDIR); Debug shows that INSTALLDIR Property is correct, and MsiSetproperty returns Error_Success.

The "After UI ExecuteAction" CA calls MsiGetProperty(hMSI, "CustomActionData", szInstallDir, MAX_PATH);

However szInstallDir is Null.

What needs to be done so that the "After UI ExecuteAction" CA obtains the correct INSTALLDIR value?

Thanks for your help.
Labels (1)
0 Kudos
(3) Replies
joshstechnij
Level 10 Flexeran
Level 10 Flexeran

The CustomActionData property is used with custom actions sequenced in the install execute sequence with an in-script execution setting of a deferred type. Any action sequenced after ExecuteAction would imply the action is in the install UI sequence, so the INSTALLDIR property can be read directly.

Note that to correctly change INSTALLDIR after CostFinalize and ensure the Directory entry and any sub-entries are re-resolved, the MsiSetTargetPath API should be used instead of MsiSetProperty. If the action were sequenced before CostFinalize, MsiSetProperty would be correct.
0 Kudos
roger_hurst
Level 5

Thanks very much for the response.

2 questions in follow-up.

I placed the immediate custom action CA after UI ExecutiveAction because it does a msiexec. I had made it deferred (and between InstallInitialize and InstallFinalize), but the msiexec would not execute due to one already active. Is there a way to make it deferred? In that event, what is the sequencing?

If the CA is after UI ExecutiveAction, what is the API for rollback in case something fails?

Thanks again.
0 Kudos
joshstechnij
Level 10 Flexeran
Level 10 Flexeran

A custom action that launches msiexec.exe to run another installation would need to be sequenced in the install UI sequence. Custom actions in the UI sequence cannot be deferred, they can only be immediate execution. Sequencing after ExecuteAction should be fine.

Since the parent installation is already committed on the machine after ExecuteAction runs, there is no way to perform a rollback if a child install from a custom action fails. Due to this limitation (and the limitation of only being able to run another MSI installation from the UI sequence), Windows Installer 4.5 provides installation chaining support. Chaining allows multiple MSI packages to be installed from one package (including in a silent install) and provides the overall installation with transaction support, meaning if one of the installations fails, everything will be rolled back and removed from the machine. More information on installation chaining can be found in the Overview of Multiple-Package Installations that Use Transaction Processing help doc.
0 Kudos