cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
kaneohe
Level 6

Need CustomActionData help!

Project Type: InstallScript MSI

I'm trying to pass values from UI into Execute and I just can't seem to get it quite right. I need to pass multiple values so I looked at our Basic MSI project (which already does this and it works swimmingly) and did the same thing:

1. Custom Set Property action, immediate execution with a Property Name of ABC (the real MSI property name) with value "/DEF=[DEF] /GHI=[GHI]" (no quotes).

2. Custom InstallScript action, deferred execution, named ABC calling my InstallScript function. This function retrieves CustomActionData and will parse the string.

This works great in the Basic MSI project. All the values arrive as expected. However, in the InstallScript MSI project the value I end up with is only the value of DEF, without the extra formatting and the value of GHI is nowhere to be seen.

I need to pass a user name and password combination but I can't seem to get both values at the same time. I've even tried assigning both values to global variables (in two separate CAs) and using a third CA to display both in a message box but it seems that "global" isn't really global in this context as both globals are empty during the third CA.

Does anyone know what I could be doing wrong here? This problem has been plaguing me for three days now!
Labels (1)
0 Kudos
(4) Replies
joshstechnij
Level 10 Flexeran
Level 10 Flexeran

If you have sequenced your property custom action in the install UI sequence, I would recommend moving it to early in the install execute sequence. The issue with InstallScript MSI projects is the install UI sequence doesn't technically exist like it does in a Basic MSI. It is manually run by the InstallScript engine before any script events are called, so property values may not yet have correct values.

One other thing to try is in an event such as OnFirstUIBefore, set the values of DEF and GHI with MsiSetProperty based on some variable, then have the set property custom action sequenced early in the execute sequence. As long as public properties are used, this should work correctly.
0 Kudos
kaneohe
Level 6

Thank you for the response. I moved it into the Execute sequence just before RemoveExistingProducts and they are showing up correctly now. I see all of them showing with the extra formatting and my parser is correctly pulling values out.

One further question. Can I use one CA to pull values out, set a global or MSI property with that value, and the reference those values in another CA? I don't seem to be able to do that. I've tried a bunch of variations but none have worked yet. Or am I required to use the values within the CA they're parsed in?
0 Kudos
joshstechnij
Level 10 Flexeran
Level 10 Flexeran

For InstallScript custom actions, each action runs in a separate instance of the engine. As such, each custom action has its own set of global variables that can't be passed to other InstallScript custom actions.

You can set MSI properties in actions sequenced in the install execute sequence, so long as they are not deferred custom actions. Deferred actions have very limited access to any properties (which is why using CustomActionData is required), and that access is read-only.
0 Kudos
kaneohe
Level 6

I figured it was something along these lines. I've decided to rearchitect how we do these tasks and have multiple CAs, one for each task, and a complimentary Set Property CA for each. This will compartmentalize the installation a bit more and probably moves this installer more in line with expected behavior for MSI installers.
0 Kudos