cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
MRKiscaden
Level 5

Installing a feature based on Property value

I am having trouble conditionally installing a feature based on the value of a property. I am using a Basic MSI project.

I have a feature: "myFeature".

"myFeature" has an Install Level of 200 (The project uses 100). And has 1 condition. That condition is if INSTALL_FEATURE="TRUE" then the level is set to 1.

However when I run the installer and INSTALL_FEATURE is "TRUE", "myFeature" is not installed.

Note that INSTALL_FEATURE is has a property value defaulting to "***DO NOT BUILD***". It is set by the user via the command line or a Checkbox in the Installer UI.

What am I doing wrong?
Labels (1)
0 Kudos
(2) Replies
schmoli
Level 6

I believe you'd have to change your installlevel to 200 to get the feature installed, in addition to the property change. However if that doesn't work I opted to do this via InstallScript at runtime. My install asks the user for a database connection and depending on the state of the database, I enable and disable two mutually exclusive features (A database "Install" and "Conversion").

Example installscript that sets "FeatureA" to install, and "FeatureB" to not install:

MsiSetFeatureState(hMSI, "FeatureA", INSTALLSTATE_LOCAL);
MsiSetFeatureState(hMSI, "FeatureB", INSTALLSTATE_ABSENT);
0 Kudos
MRKiscaden
Level 5

The MsiSetFeatureState worked, thanks.

However I am still wondering why using the condition directly in the Feature Condition editor fails to work.
0 Kudos