How to Select Features From Command Line

The accepted answer already mentions the ADDLOCAL property, but seems to imply that you can select only one feature. You can actually select multiple features by seperating them by commas like this:

msiexec /i install.msi ADDLOCAL=Feature1,Feature2

or

msiexec /i install.msi ADDLOCAL=Feature2,Feature3

Another hint: you can discover these feature names by opening the msi with orca. This is very useful when you want to use these tricks to create a bootstrapper that installs certain features of thirdparty msi packages.


There are a number of properties that can control the install states of Features. Check out this MSI SDK documentation and the links from it: http://msdn.microsoft.com/en-us/library/aa367536(VS.85).aspx


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>

Then to Install either FeatureA or FeatureB

msiexec /i install.msi ADDLOCAL=[FEATUREA | FEATUREB]

Tags:

Wix