PDA

View Full Version : Mutually exclusive features



thore-l
01-10-2003, 08:30 AM
I am trying to disable installation of one or more features if another one is selected for installation. Does anyone know if and how this may be done in IS 4.0. I cannot find a way to do it with the normal conditions.

Chandima
01-10-2003, 10:11 AM
This is not natively supported in Express. The only alternative I can think of would be to use a Custom Action. For this to work however, you will need to the FeatureKey value. This is the internal name that Windows Installer uses to identify each feature. You will need to open the built msi file in ORCA and look in the first column of the Feature table to get this info.

Try the following as an exercise:
1. Create a new Project
2. Add 4 root level features and use the default names (their FeatureKey values are similar to the default name)
3. Add a file to each feature
4. Go to Setup Types view and de-select them from all Setup Types. This means that none of these features will get installed at runtime.
5. Now create a VBScript custom action that launches after Ready to Install dialog. Make it point at the following script:

Session.FeatureRequestState("NewFeature1")=3
Session.FeatureRequestState("NewFeature3")=3

6. Build and Install. This will install just NewFeature1 and NewFeature3. The custom actions decides which features to install.

Similarly, suppose you ignored Step4. This means all features will install regardless of which setup type you choose. If you used the following VBScript as a custom action, it will prevent NewFeature2 and NewFeature3 from getting installed:

Session.FeatureRequestState("NewFeature2")=""
Session.FeatureRequestState("NewFeature3")=""

Using VBScript's If and Else statements you build your own logic for deciding which features to install and which not to.