Question

In my WIX setup package I have a feature that contains merge module and must be installed conditionally. The condition should be evaluated using property set by custom action. Here's how this looks in my WXS:

<Directory Id="INSTALLLOCATION" Name="testSetup">
    <Merge Id="mergeA" Language="1033" SourceFile="test.msm" DiskId="1" />
</Directory>

<InstallExecuteSequence>
  <Custom Action="find" Before="CostInitialize">Not Installed</Custom>
</InstallExecuteSequence>

<CustomAction Id="find" Return="check" BinaryKey="script" VBScriptCall="findA" />
<Binary Id="script" SourceFile="script.vbs" />

Since level=0 disables the feature I've put NOT to install only if the path exists.

<Feature Id="productFeatA" Title="featA" Level="1">
  <Condition Level="0"><![CDATA[NOT pathA]]></Condition>
  <MergeRef Id="mergeA" />
</Feature>

And the simple test VBS script:

Function findA
     Session.Property("pathA") = "test"
End Function

So using properties that are set via custom action I cannot get feature conditions to work. Any idea what I'm doing wrong here?

Était-ce utile?

La solution

Your custom action is currently only scheduled to run in the InstallExecuteSequence. If your install runs through the InstallUISequence then the Feature will still get enabled. The InstallUISequence is unless you explicitly specify to run the install 'quietly'.

Fortunately, the fix is easy. Add the following as a peer of the InstallExecuteSequence:

<InstallUISequence>
  <Custom Action="find" Before="CostInitialize">Not Installed</Custom>
</InstallUISequence>
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top