I’m currently working on a project where I am using Wix
for the installer. My application is developed using .net core
and having appsettings
You can't use session["BUFFER.SIZE"]
in a deferred custom action.
To pass a property from the MSI into a deferred custom action you need to use another action to set the value and then read that value in your custom action using a slightly different mechanism.
On the wixtoolset page for custom action you'll see it has a special mention in the Property description pointing to this microsoft article which talks about how getting context in a deferred custom action works.
An important thing to note about the second action is that its property value must be an exact match to the deferred custom action's Id value.
<CustomAction Id="SetGetParsValues" Property="GetParsValues" Value="BUFFER.SIZE=[BUFFER.SIZE]" />
<InstallExecuteSequence>
<Custom Action="SetGetParsValues" Before="GetParsValues"><![CDATA[NOT Installed]]></Custom>
</InstallExecuteSequence>
then in your custom action you can access the value by changing your session["BUFFER.SIZE"]
to be session.CustomActionData["BUFFER.SIZE"]
It might also be useful for you to know about [#FileId]
which gets evaluated as the install location of a component's File using the File's Id value. Then you can pass in two values to your custom action by updating the Value in the SetGetParsValues custom action to be Value="BUFFER.SIZE=[BUFFER.SIZE];JsonFilePath=[#JsonFileId]"
. I'm not 100% sure doing [#JsonFileId]
will work there so you can also just set a property value before that and use the property value in the Custom action's Value.