【发布时间】:2014-12-18 16:56:17
【问题描述】:
我有一个名为 SELECTEDFEATURESET 的属性,其默认值为“无”。在自定义对话框中,我尝试根据用户按下的按钮设置此属性。最后,我使用该属性来决定是否应安装某些组件。
在主安装程序文件 (Product.wxs) 中定义的属性:
<Property Id='SELECTEDFEATURESET' Value='none' />
在对话框中设置属性:
<Control Id="InternalFeatureButton" Type="PushButton" Text="FeatureSetA">
<Publish Event="NewDialog" Value="InstallDirDlg">1</Publish>
<Publish Property="SELECTEDFEATURESET" Value="FeatureSetA">1</Publish>
</Control>
<Control Id="ProductionFeatureButton" Type="PushButton" Text="FeatureSetB">
<Publish Event="NewDialog" Value="InstallDirDlg">1</Publish>
<Publish Property="SELECTEDFEATURESET" Value="FeatureSetB">1</Publish>
</Control>
<Control Id="DemoFeatureButton" Type="PushButton" Text="FeatureSetC">
<Publish Event="NewDialog" Value="InstallDirDlg">1</Publish>
<Publish Property="SELECTEDFEATURESET" Value="FeatureSetC">1</Publish>
</Control>
决定是否安装该功能:
<Feature Id='ParentFeature' Level='0'>
<ComponentRef Id='ComponentA' />
<Condition Level='1'><![CDATA[SELECTEDFEATURESET="FeatureSetA"]]></Condition>
</Feature>
<Feature Id='ParentFeature' Level='0'>
<ComponentRef Id='ComponentB' />
<Condition Level='1'><![CDATA[SELECTEDFEATURESET="FeatureSetB"]]></Condition>
</Feature>
<Feature Id='ParentFeature' Level='0'>
<ComponentRef Id='ComponentC' />
<Condition Level='1'><![CDATA[SELECTEDFEATURESET="FeatureSetC"]]></Condition>
</Feature>
当我运行安装程序并按下 FeatureSetA 按钮时,没有安装可选组件。当我使用“FeatureSetA”初始化 SELECTEDFEATURESET 属性时,会安装 ComponentA(A、B 和 C 相同)。
为什么在特征条件评估时 SELECTEDFEATURESET 的值是 'none' 而不是 'FeatureSetA' / 'FeatureSetB' / 'FeatureSetC'?
我该如何解决?
【问题讨论】:
标签: wix windows-installer