cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
MSherman
Level 3

InstallShield - CustomActionData to multiple custom actions - managed

When I've used customactiondata struct in the past, i have only needed to pass the information to one script, where I can access the data and then USE it. However, with a managed custom action, you can't appear to "index" through multiple values supplied via CustomActionData - you need to split them into individual actions first.

For instance, with a Set Property in the Execute sequence (after CostFinalize), Pass CAD to a custom action called CAD with 3 properties, like so:

[PROP1];[PROP2];[PROP3]

Then that deferred custom action you specified must do this (this is powershell):

$cad = get-property -name CustomActionData
trace-info -LogMessage $cad

$splitArray = $cad.split(";")
$prop1= $splitArray[0]
$prop2 = $splitArray[1]
$prop3 = $splitArray[2]

However, what do you do if you then want to use those 3 properties as parameters to a managed custom action? I could not find any way to set this variable data back into variables, but have them accessible to actions in the deferred stage.

Am i missing something? This seems like a major limitation to this functionality. 

Labels (1)
0 Kudos
(4) Replies
Azmaeus
Level 6

I'm not sure I understand what you're trying to do. Are you trying to now update properties PROP1, PROP2, and PROP3 so another CA can then have access to this updated information? Or are you trying to create a second CA and you want to pass PROP2, PROP4, and PROP5 to that other CA and want to know how to pass a different CAD to separate CAs?

0 Kudos

The first one. I ultimately want to be able to call a managed action something like

Namespace.DllName.Class.Method(PROP1, PROP2, PROP3)

where PROP1 through 3 have to be passed through CustomActionData because they are from the installer and the custom action operates on a file within the installer (meaning deferred).

1. Set.Property into a custom action, pass 3 properties delimited by ;

2. Deferred Powershell script or VB Script to take CustomActionData and split it into 3 separate properties.

3. Use 3 separate properties in a managed custom action.

My issue is that properties set in #2 are not available in #3. I expected to be able to set properties in a deferred custom action and they'd be available in the entirety of all deferred custom actions.

0 Kudos

I looked into this a while back and it's not possible in this manner. Some suggestions I found were to write to the registry, or to files on the hard drive. I preferred the latter, and would suggest writing to SUPPORTDIR so it's cleaned-up when the install ends (I hope, but haven't tried it yet). I ended up realizing that for my purpose I could run the information-gathering scripts in immediate execution which can write to the MSI properties, then the scripts that actually make changes to the system just need to read the values (or can write/read the changes to the system).

Yeah, that's what i thought. What a very weak underthought capability, for something so mature as Windows Installer. I figured it was worth a shot in doing...instead I have to use powershell because my managed custom action is written in .NET. Therefore i can do both the split of CustomActionData, AND the actual assembly call. Ugly, but at least it works.

 

thanks for looking!

0 Kudos