Wix:自定义操作设置的属性上的特征条件

时间:2013-05-08 10:36:34

标签: vbscript wix custom-action

在我的WIX安装程序包中,我有一个包含合并模块的功能,必须有条件地安装。应使用自定义操作设置的属性评估条件。以下是我在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" />

由于level = 0会禁用我只在路径存在时才安装的功能。

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

简单的测试VBS脚本:

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

因此,使用通过自定义操作设置的属性,我无法使功能条件起作用。知道我在这里做错了吗?

1 个答案:

答案 0 :(得分:2)

您的自定义操作目前仅安排在InstallExecuteSequence中运行。如果您的安装通过InstallUISequence,那么Feature仍会启用。 InstallUISequence除非您明确指定“安静地”运行安装。

幸运的是,修复很容易。将以下内容添加为InstallExecuteSequence的对等方:

<InstallUISequence>
  <Custom Action="find" Before="CostInitialize">Not Installed</Custom>
</InstallUISequence>
相关问题