Wix 在条件要素的自定义对话框中设置特性

Wix 在条件要素的自定义对话框中设置特性,wix,windows-installer,Wix,Windows Installer,我有一个名为SELECTEDFEATURESET的属性,默认值为“none”。在自定义对话框中,我试图根据用户按下的按钮设置此属性。最后,我使用该属性来决定是否应安装某些组件 在主安装程序文件(Product.wxs)中定义的属性: 在对话框中设置属性: <Control Id="InternalFeatureButton" Type="PushButton" Text="FeatureSetA"> <Publish Event="NewDialog" Value="I

我有一个名为SELECTEDFEATURESET的属性,默认值为“none”。在自定义对话框中,我试图根据用户按下的按钮设置此属性。最后,我使用该属性来决定是否应安装某些组件

在主安装程序文件(Product.wxs)中定义的属性:


在对话框中设置属性:

<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>

1.
1.
1.
1.
1.
1.
决定是否应安装该功能:

<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属性时,就会安装组件A(A、B和C也是如此)

为什么在特征条件评估时,SELECTEDFEATURESET的值为“none”而不是“FeatureSetA”/“FeatureSetB”/“FeatureSetC”?

如何修复它?

我通过将条件从特征移动到组件来修复它

<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>