这可能是一个幼稚的问题。我必须手动编辑.WXS文件,以使其支持从命令行选择功能。
例如,.WXS文件中有3个功能。
<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。
如何在WIX中完成这项工作?
最佳答案
我将Feature1,Feature2和Feature3更改为Components,然后声明如下内容:
<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
msiexec /i install.msi ADDLOCAL=[FEATUREA | FEATUREB]
关于wix - 如何从命令行选择功能,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/246329/