2015-06-01 35 views
1

我正在嘗試創建一個安裝程序,該安裝程序根據組合框的選擇安裝了一些組件,但似乎情況不起作用。我聲明瞭組合框,如下:WiX:基於組合框選擇安裝組件

... 
<UI> 
    <ComboBox Property="Option"> 
    <ListItem Text="Red" Value="red" /> 
    <ListItem Text="Blue" Value="blue" /> 
    <ListItem Text="Green" Value="green" /> 
    </ComboBox> 
... 

我有一個特點:

<Feature Id="ProductFeature" Title="MyProgram" Level="1"> 
    <ComponentGroupRef Id="ProductComponents" /> 
</Feature> 

和組件集團聲明如下:

<ComponentGroup Id="ProductComponents" Directory="INSTALLFOLDER"> 
    <Component Id="MainComponent"> 
    <File Id="exe" Name="Main.exe" Source="Main.exe" /> 
    </Component> 
    <Component Id="ComponentRed"> 
    <Condition>Option=red</Condition> 
    <File Id="R" Name="config.txt" Source="red.txt" /> 
    </Component> 
    <Component Id="ComponentBlue"> 
    <File Id="B" Name="config.txt" Source="blue.txt" /> 
    <Condition>Option=blue</Condition> 
    </Component> 
    <Component Id="ComponentGreen"> 
    <File Id="G" Name="config.txt" Source="green.txt" /> 
    <Condition>Option=green</Condition> 
    </Component> 
</ComponentGroup> 

回答

1

財產必須公開(大寫),並且需要在CDATA內進行比較。您可以使用不區分大小寫的比較~=

<Component Id="ComponentRed" Guid="*" Directory="INSTALLFOLDER"> 
    <File Id="R" Name="red.txt" Source="red.txt" /> 
    <Condition> 
     <![CDATA[OPTION~="Red"]]> 
    </Condition> 
</Component> 

<Control Id="MyComboBox" Type="ComboBox" X="20" Y="140" Width="56" Height="17" 
     Property="OPTION"> 
    <ComboBox Property="OPTION"> 
     <ListItem Text="Red" Value="Red" /> 
     <ListItem Text="Blue" Value="Blue" /> 
     <ListItem Text="Green" Value="Green" /> 
    </ComboBox> 
</Control> 
+0

謝謝,這解決了我的問題! –

相關問題