InstallShield conditional feature installation

2020-04-18 01:18发布

问题:

How can I make a feature on my InstallShield project to be installed only if a registry value contains a certain value? That value may be only "YES" or "NO".

I tried to configure a System Search like that :

Root : HKLM Key : Software\MyKey\the_key_to_check

Value : I let it blank

Store the value in this property : ISVALUE (a just created property, without any value), and "just store the value in the property".

Then, on my feature condition : Install Level : 1 Condition : Level:200, ISVALUE=YES

The attempted result is -> If MyValue equals YES, then install that feature, if not, don't install that feature. But it the condition seems to be never evaluated.

Could anyone help me to perform this task?

回答1:

INSTALLLEVEL: Quick review of the INSTALLLEVEL concept courtesy of Chris Painter: Set sub-features to not install by default. Essentially: there is a level value for every feature and an overall INSTALLLEVEL for the whole setup. Every feature at or below the INSTALLLEVEL gets installed by default. I think the default INSTALLLEVEL in Installshield is 100 (adjustable).

Installshield: Here is a feature condition sample with Installshield screenshots: Preselecting Features within an InstallShield Basic MSI Project. A special case is when you set the Level to 0 - then you do not install the feature and also hide it from the setup GUI (see link below on why this is a very bad idea to set as default for a feature - I think it is OK to assign in a condition however, just don't make it default).

Suggestions: You could try something like this:

  • Option 1: Level: 0, Condition: ISVALUE=NO (hide feature in GUI and do not install feature if ISVALUE=NO)

  • Option 2: Level: 101, Condition: ISVALUE=NO (do not install feature if ISVALUE=NO)

For both options, remember to set the default feature level to "install by default". In other words at or below the setup's overall INSTALLLEVEL. For example 100.


Some Links:

  • Unselected Feature Being Installed (more than you don't want to know about features)
  • Failing condition wix (why you must not set feature level to 0 by default)
  • How to set the level of feature based on condition in wix? (similar issue in WiX)