问题
My installer has a Feature called "Tools"
What is installed by this feature is dependent on which version of SQL Server the client is running.
How can I have one feature with a condition that says "If SQL 2008 do ComponentGroupRef ID=SQL2008 otherwise ComponentGroupRef ID=SQL2012"
I'm creating 2 properties to hold the directory for SQL2008 and SQL2012, so those are the properties I'm using to make my determination.
This is close, but shows "Tools" feature twice.
<Feature Id="SQL2008Tools" Title="Tools" Level="1" Description="Installs all support UI Tools for SQL 2008">
<Condition Level="1"><![CDATA[SQL2008BINDIR AND NOT SQL2012BINDIR]]></Condition>
<ComponentGroupRef Id="Tools2008Component"/>
</Feature>
<Feature Id="SQL2012Tools" Title="Tools" Level="1" Description="Installs all support UI Tools for SQL 2012">
<Condition Level="1"><![CDATA[SQL2012BINDIR]]></Condition>
<ComponentGroupRef Id="Tools2012Component"/>
</Feature>
As always - thanks for any help!
回答1:
As you've found the title of a feature does not have to be unique. You have two features with the same title so it shows that way.
Try using nested features:
<Feature Id="SQLTools" Title="Tools" Level="1" Description="Installs support UI Tools for SQL Server">
<Feature Id="SQL2008Tools" Title="SQL 2008 Tools" Level="1" Description="Installs all support UI Tools for SQL 2008">
<Condition Level="1"><![CDATA[SQL2008BINDIR AND NOT SQL2012BINDIR]]></Condition>
<ComponentGroupRef Id="Tools2008Component"/>
</Feature>
<Feature Id="SQL2012Tools" Title="SQL 2012 Tools" Level="1" Description="Installs all support UI Tools for SQL 2012">
<Condition Level="1"><![CDATA[SQL2012BINDIR]]></Condition>
<ComponentGroupRef Id="Tools2012Component"/>
</Feature>
</Feature>
来源:https://stackoverflow.com/questions/25815446/wix-installer-one-feature-with-condition-to-decide-which-componentgroupref-to-u