我有一个名为SELECTEDFEATURESET的属性,默认值为'none'。在自定义对话框中,我正在尝试根据用户按下的按钮设置此属性。最后,我使用该属性来决定是否应安装某些组件。
主安装程序文件(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'的值?
我该如何解决?
答案 0 :(得分:0)
我修复了我将条件从特征移动到组件。