2
votes

I am writing an installer using wix. For silent installation using msiexec, i would like to provide few parameters from the commandline which i want to set to wix properties.

These properties I am using to enable/disable few features.

Can anyone please tell me how to read those command line properties passed to msiexec. Using C++ Custom Action we read using MsiGetProperty

Thanks a lot..

Best Regards, Marc

3

3 Answers

8
votes

To make the property available from the command line you should define it using an upper case name. I often use a launch condition to check the properties have been passed on the command line:

<Property Id="PROPNAME" Admin="yes" />
<Condition Message="Public Property PROPNAME not passed">Installed or PROPNAME</Condition>

The Installed variable only checks for the property value on install rather than uninstall.

The command line for msiexec looks like this:

msiexec -i <msiname.msi> PROPNAME="PROPVALUE"
6
votes

You should also look into the ADDLOCAL property. You can probably simplify your problem with a command line like:

msiexec /i product.msi ADDLOCAL=FEATURE1,FEATURE2,FEATURE4,FEATURE5
2
votes

A Feature element can use one or more Condition elements as children. A feature condition can use installer properties directly in their formatted form, for example:

[PROPERTY_NAME] = "value"

Each feature Condition element must use a Level attribute. In your case it can be 0 so the feature is not installed when the condition is met. Basically, you will set a condition for skipping the feature.