I want to include different dll in the installation based on certain values. So, I am trying to load a component based on a property that is set using custom action.
In wxs file:
...
<Property Id="PropDllVersion" Value="0" />
...
<CustomAction Id="CheckPropDllVersion" BinaryKey="CustomAction1.dll" DllEntry="GetPropVersion" Return="ignore" Execute="immediate"/>
...
<InstallExecuteSequence>
<Custom Action="CheckPropDllVersion" After="ValidateProductID" />
</InstallExecuteSequence>
...
<Component Id="Test"
Guid="B81F832D-2D96-4169-9BD0-8D77098FEC60">
<Condition><![CDATA[PropDllVersion = "19"]]></Condition>
<File Id="File15"
Name="xyz.dll"
Vital="yes"
KeyPath="yes"
AssemblyManifest="File5"
AssemblyApplication="File5"
Assembly=".net"
DiskId="1"
/>
</Component>
...
Then in the custom action file:
[CustomAction]
public static ActionResult GetPropVersion(Session session)
{
session["PropDllVersion"] = "19";
}
I can see in the msi log file that this property is changed to 19, however the xyz.dll is not included in the installation. It looks like the PropDllVersion is not set at the condition level or am I doing something wrong... I tried to sequence it at many other places still it is not working...
If I use a global property in the condition instead of my property it works!
Please note that private properties (its name contains lowercase letters) use their default values in InstallExecuteSequence. So you should use a public property, for example PROP_DLL_VERSION.