如何从命令行选择功能 [英] How to Select Features From Command Line
问题描述
这可能是一个幼稚的问题.我必须手动编辑 .WXS 文件以使其支持从命令行选择功能.
This might be a naive question. I have to manually edit a .WXS file to make it support select features from command line.
例如,.WXS 文件中有 3 个功能.
For example, there are 3 features in .WXS file.
<Feature Id="AllFeature" Level='1'>
<Feature Id="Feature1" Level='1'> </Feature>
<Feature Id="Feature2" Level='1'> </Feature>
<Feature Id="Feature3" Level='1'> </Feature>
</Feature>
现在,我想从命令行选择功能.比如说,如果我输入msiexec/i install.msi FEATURE=A",则安装Feature1"和Feature2";如果我输入msiexec/i install.msi FEATURE=B",则安装Feature1"和Feature3".在这种情况下,A"映射到特征 1 和特征 2;B"映射到功能 1 和 3.
Now, I want to select features from command line. Say, if I type "msiexec /i install.msi FEATURE=A", then "Feature1" and "Feature2" is installed; if I type "msiexec/i install.msi FEATURE=B", then "Feature1" and "Feature3" is installed. In this case, "A" maps to Feature 1 and 2; "B" maps to Feature 1 and 3.
如何在 WIX 中完成此操作?
How to accomplish this in WIX?
推荐答案
我会将 Feature1、Feature2 和 Feature3 改为 Components,然后声明如下:
I would change Feature1, Feature2 and Feature3 to Components, then would declare something like this:
<Feature Id="FEATUREA" Title="Super" Level="1" >
<ComponentRef Id="Component1" />
<ComponentRef Id="Component2" />
</Feature>
<Feature Id="FEATUREB" Title="Super1" Level="1" >
<ComponentRef Id="Component1" />
<ComponentRef Id="Component3"/>
</Feature>
然后安装 FeatureA 或 FeatureB
Then to Install either FeatureA or FeatureB
msiexec /i install.msi ADDLOCAL=[FEATUREA | FEATUREB]
这篇关于如何从命令行选择功能的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!