3
votes

I'm making an installer which must configure a web service it installs. It dynamically generates properties which hold the data collected from the user in the UI sequence, installs the service and sets the parameters.

SetParams CA uses dynamic properties generated in the UI sequence. To access data in deferred CA, I've created an immediate CA which dynamically extracts session data and puts it in the CustomActionData.

<CustomAction Id='SaveParams' BinaryKey='Setup.CustomAction' DllEntry='SaveParameters' Execute='immediate'  Return='check'/>
<CustomAction Id='SetParams' BinaryKey='Setup.CustomAction' DllEntry='SetParameters' Execute='deferred' Impersonate='no' Return='check' />

<Custom Action='SaveParams' Before='SetParams'><![CDATA[REMOVE <> "ALL"]]></Custom>
  <Custom Action='SetParams' Before='InstallFinalize'><![CDATA[REMOVE <> "ALL"]]></Custom>

Following is the part of SaveParameters method in the custom action

customActionData.Append(string.Format(CultureInfo.InvariantCulture, "{0}={1};", propertyName, session[propertyName]));

This approach works! When started from admin cmd session[propertyName] returns the correct value, but when I run the installer change from non-elevated cmd prompt, I cannot access the property values in the immediate CA - session[propertyName] returns empty string ?!

I can access the (static) property defined in wxs file

<Property Id="INSTALL" Secure="yes" /> 

but not the one's I've added in some other immediate custom action in the UI sequence like this

session[property] = "VALUE"; //eq. property = DATABASENAME

Does anyone have any idea why I cannot read the dynamic public property value?

NOTE: Spin off from this question.

1

1 Answers

1
votes

There are two options for resolving this issue. 1. Immediate action which reads properties to be moved from execution sequence to UI sequence 2. Actions in execution phase can access data from secure properties as stated in the question. If the properties are dynamically created in CA, they must be added to SecureCustomProperties system property. Separator char is ';'.