Summary
This article discusses how to use the install level to turn features on and off for users in MSI installations.Synopsis
This article discusses how to use the install level to turn features on and off for users in MSI installations. The article applies to Basic MSI Project Type.
Discussion
There is a defined install level specified by the INSTALLLEVEL global property. This property is an integral value from 1 to 32,767 that determines which features are installed and which are visible.
All features have individual install levels. If a feature's install level is greater than 0 and less than or equal to the installation's install level, then that feature will be turned on (i.e., installed unless the user chooses otherwise in a custom selection dialog). If a feature's install level is greater than the installation's install level, then that feature will be turned off (i.e., not installed unless the user chooses otherwise in a custom selection dialog). If a feature's install level is 0, then that feature is disabled and is not displayed in the custom selection dialog.
All features have a condition property. This property allows you to set the install level for the feature based on a condition. If the condition is met, then the feature's install level is set to the value specified. Thus, you can use the feature's condition to turn on, turn off, or disable your features at run time.
Following these steps in a sample project to learn how to turn feature on and off conditionally.:
- Create 4 features: FLeaveOn, FTurnOn, FTurnOff, and FDisable.
- Create a dummy component (i.e., NewComponentN) under each feature.
- Set the install levels for the features as follows. Note that the default INSTALLLEVEL for a new project is 100.
Feature Level Initial Status FLeaveOn 1 On FTurnOn 150 Off FTurnOff 50 On FDisable 50 On - Build (ignore warnings) and run the installation, selecting the custom setup type. This will show you how the install levels of the features affect the status of the feature. Cancel out of the installation.
- Set conditions on the features as follows. Note that the properties in the conditions are capitalized. This is because we need to use global properties, which are denoted by all caps.
Feature Level Condition FLeaveOn FTurnOn 1 FTURNON="On" FTurnOff 150 FTURNOFF="Off" FDisable 0 FDISABLE="Disable" - In the Project view's Property Manager, create the following properties.
Name Value FTURNON Off FTURNOFF On FDISABLE Enable - In the Custom Actions and Sequences view, create the following Set Property custom actions. Note that type 51 is used to set a property. You may also use the custom action wizard to create these actions.
Action Type Property Name Property Value Comments SetFDISABLE 51 FDISABLE Disable SetFTURNOFF 51 FTURNOFF Off SetFTURNON 51 FTURNON On - In the Sequences view, expand the Installation | User Interface node.
- Insert the three custom actions in this sequence before the CostFinalize action. Set the condition for each custom action to "NOT Installed" (no quotes). Note that the CostFinalize action queries the feature's conditions to determine the state of each feature. Calling your custom actions after CostFinalize will result in their initial values being used.
- Build (ignore warnings) and run the installation, selecting the custom setup type. This will show you the results. FLeaveOn and FTurnOn should be turned on, FTurnOff should be turned off, and FDisable should be hidden and turned off. Cancel out of the installation.
Additional Information
For more information on the INSTALLLEVEL property, see the Windows Installer Help topic INSTALLLEVEL or the InstallShield HelpNet article on configuring a feature's install level setting.
For more information on creating Feature Conditions, see the InstallShield HelpNet article on Setting Feature Conditions.
Related Articles
Setting a Feature or Component Destination at Run Time Using FeatureSetTarget 3Number of Views Accessing the MSI Database at Run Time 18Number of Views Populating A List Box Dynamically At Run Time 5Number of Views Set a Directory Table Entry at Run Time 3Number of Views Creating Predetermined User Accounts at Run Time on Windows 3Number of Views
Hi, I am Reva - Ask me anything.
No new updates
Thanks for the feedback!
Your feedback has been saved.Rate this response:
Add Additional feedback ( Optional )
Are you sure you want to cancel
the case creation?
Are you sure you want to cancel the case creation?
Are you sure you want to close this case
| Products | Region | Phone Numbers |
|---|---|---|
| FlexNet Operations FlexNet Embedded FlexNet Publisher FlexNet Connect FlexNet Code Insight InstallAnywhere InstallShield |
North America * |
+1 630-332-2513 (toll) +1 877-279-2853 (toll-free in North America) |
| Europe * |
+44 1925 944367 (toll) +44 800 047 8642 (toll-free in Europe) |
|
| Japan * | +81 3-4540-5335 (select option 2) | |
| Australia * |
+61 3 9895 2177 +61 1800 560 603 (toll-free in Australia) |
|
|
Usage Intelligence (formerly
Revulytics) Compliance Intelligence |
Please use the Case Portal to submit your support ticket or reach out to your Revenera contact. | |
Case id: 00001065
Activity: Status change: 2 hours ago