这可能是一个天真的问题。我必须手动编辑.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”和“Feature2”。安装;如果我输入“msiexec / i install.msi FEATURE = B”,那么“Feature1”将被输入。和“特征3”已安装。在这种情况下,“A”表示“A”。映射到要素1和2; &QUOT; B&QUOT;映射到功能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]

其他提示

已接受的答案已经提及ADDLOCAL属性,但似乎暗示您只能选择一个功能。您可以通过以下逗号分隔多个功能来实际选择:

msiexec /i install.msi ADDLOCAL=Feature1,Feature2

msiexec /i install.msi ADDLOCAL=Feature2,Feature3

另一个提示:您可以通过使用 orca 。当您想要使用这些技巧来创建安装第三方msi软件包的某些功能的引导程序时,这非常有用。

有许多属性可以控制功能的安装状态。查看此MSI SDK文档及其链接: http: //msdn.microsoft.com/en-us/library/aa367536(VS.85).aspx

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top