To create an MSI, I use the Gradle plugin SetupBuilder.
After the installation, I need to execute a binary from the installation directory. But I'm unable to access the INSTALLDIR property:
msi {
postinst = '''
MsgBox ("INSTALLDIR: " & Session.Property("INSTALLDIR"))
'''
}
But:
I found that SetupBuilder creates the following custom actions in the .wxs file:
<CustomAction Execute="deferred" Id="Postinst_Script0" Impersonate="no" Script="vbscript">
MsgBox ("INSTALLDIR: " & Session.Property("INSTALLDIR"))
</CustomAction>
<CustomAction Id="SetPropertiesPostinst_Script0" Property="Postinst_Script0" Value="INSTALLDIR='[INSTALLDIR]';ProductCode='[ProductCode]';INSTANCE_ID='[INSTANCE_ID]'"/>
They're then called like this:
<InstallExecuteSequence>
<Custom Action="Postinst_Script0" Before="InstallFinalize">NOT Installed OR REINSTALL OR UPGRADINGPRODUCTCODE</Custom>
<Custom Action="SetPropertiesPostinst_Script0" Before="Postinst_Script0"/>
</InstallExecuteSequence>
According to the WiX documentation on CustomAction Element, the combination of Property
and Value
should result in a Custom Action Type 51 and this is pretty much where I get lost. Too many unknowns to understand, just for accessing a simple property.
Can someone please help me understand; how do I access the property?