Accessing properties in a deferred action
If you try to access a property from a custom action during the Execute sequence's deferred stage, you'll find that you get an error. This is because only a finite number of properties are available here. As a workaround, you can store the values of your properties in another property called CustomActionData
and pass that to the deferred custom action.
There are two ways to do this: from your WiX code, or from inside another C# custom action. For the first, use a Type 51
custom action to set the value of the CustomActionData
property.
In the next example, we want to pass a property called MYPROPERTY
to a custom action called myDeferredCA
. So, we create another action called SetProperty
that sets a property also called myDeferredCA
to the value of MYPROPERTY
. It's important that the name of the property you're setting matches the name of the deferred custom action.
<Property Id="MYPROPERTY" Value="my value" /> <CustomAction Id="SetProperty...