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

Implementing Setup Types in a Basic MSI Project

Implementing Setup Types in a Basic MSI Project

Summary

This article discusses how to implement setup types in a Basic MSI project using either MSI control events or InstallScript custom actions.

Synopsis

This article discusses how to implement setup types in a Basic MSI project using either MSI control events or InstallScript custom actions.


Discussion

Implementing setup types can be done by using the INSTALLLEVEL property of the product and Install Level property of features. There is an overall INSTALLLEVEL of the installation, which is a number between 1 and 32,767. Features each have an Install Level property, which is a number between -32,767 and 32,767.

  • If a feature's Install Level value is less than or equal to the product's INSTALLLEVEL property, the feature is turned on.

  • If the feature's Install Level value is zero, the feature is disabled and not displayed.

  • If a feature's Install Level value is greater than the product's INSTALLLEVEL property, the feature is turned off.

By default, the product's INSTALLLEVEL is set to 100. This property can be found in the Property Manager view of the project.

Method 1: Using MSI Control Events

You can implement setup types using an MSI control event in your project by doing the following:

  1. Determine the setup types you want in your installation and determine InstallLevel values for them.

  2. Assign values to features' Install Level property to correspond to the desired setup type.

  3. Modify the SetupType dialog.

  4. Add an event to the Next button on the SetupType dialog that sets the install level.

The following is an example that details how to do this in a simple project with 3 setup types (Complete, Minimum, and Custom) using an MSI control event.

  1. Determine the setup types you want to install in your installation and determine InstallLevels for them.

    For this example, we have determined them as follows:

    • Minimum: 100
    • Custom: 125
    • Complete: 150

  2. Assign values to features? Install Level property to correspond to the desired setup type.

    In this example, we have 3 values (app.exe, help.hlp, and example.txt). Each file should be in its own component and each component should be in its own feature. We?ll assign the feature Install Level as follows:

    • App.exe: 1
    • Help.hlp: 101
    • Example.txt: 126

    Note: To access the feature install level property, open the Features or Setup Design view. Click a feature and find the Install Level property on the right side. Set this field to the appropriate value.

    So, files are installed for setup types as follows:

    • Complete: App.exe, Help.hlp, Example.txt
    • Custom: App.exe, Help.hlp
    • Minimum: App.exe

  3. Modify the SetupType dialog.

    1. Open the Dialogs view.

    2. Find the SetupType dialog.

    3. Select the language-specific version of the SetupType dialog in the Dialogs view.

    4. Add a new radio button control to the dialog and label it. It should look similar to the other radio button controls. The dimension properties may need to be adjusted. Additionally, an icon control similar to the others displayed by default may be added.

    5. Set the value of the new radio button by selecting it on the dialog and editing its value field on the right side. The value should be set to Minimum.

  4. Add an event to the Next button on the SetupType dialog that sets the install level.

    1. In the Dialogs view, click on Behavior for the SetupType dialog.

    2. Select the Next (PushButton) in the middle panel.

    3. Add a new event to the Next button with the following settings:

      Event: SetInstallLevel
      Argument: 125
      Condition: _IsSetupTypeMin=?Custom?

      Note: The setup types work based on the behavior of the Next button on the SetupType dialog. When Complete is selected, the AddLocal property is set to ALL, which will cause all features to be installed regardless of each features install level or the install level of the installation (unless the feature's install level is 0). When Minimum is selected, the install level is already set to 100, so no action needs to be taken. In the case where Custom is selected, this event added to the Next button will select the features that have their install level set to less than 125.

  5. Right-click the new event and select Move Up until it is at the top of the list.

Method 2: Using InstallScript Custom Actions

You can implement setup types in your project with InstallScript custom actions by doing the following:

  1. Determine the setup types you want in your installation and determine InstallLevel values for them.

  2. Assign values to features' Install Level property to correspond to the desired setup type.

  3. Modify the SetupType dialog.

  4. Create a custom action that sets the INSTALLLEVEL value.

  5. Sequence the custom action accordingly.

The following is an example that details how to do this in a simple project with 3 setup types (Complete, Minimum, and Custom) using an InstallScript custom action.

  1. Determine the setup types you want in your installation and determine InstallLevel values for them.

    For this example, we've determined them as follows:

    • Minimum: 100
    • Custom: 125
    • Complete: 150

  2. Assign values to features' Install Level property to correspond to the desired setup type.

    In this example, we have 3 files (app.exe, help.hlp, and example.txt). Each file should be in its own component and each component should be in its own feature. We'll assign the feature Install Level value as follows:

    • app.exe: 1
    • help.hlp: 101
    • example.txt: 126

    Note: To access the feature Install Level property, open the Features or Setup Design view. Click a feature and find the Install Level property on the right side. Set this field to the appropriate value.

    So, files are installed for setup types as follows:

    • Complete: App.exe, help.hlp, example.txt
    • Minimum: App.exe
    • Custom: App.exe, help.hlp

  3. Modify the SetupType dialog.

    1. Open the Dialogs view.

    2. Find the SetupType dialog.

    3. Add a new radio button control to the dialog and label it. It should look similar to the other available radio button controls. The dimension properties may need to be adjusted. Additionally, an icon control similar to the others displayed by default may be added.

    4. Set the value of each radio button by selecting each radio button on the dialog and editing its value field on the right side. The values should be set to Complete, Minimum, Custom.

  4. Create a custom action that sets INSTALLLEVEL. The code below is in InstallScript.
    function MyFunction(hMSI)
       STRING svProperty;
       NUMBER nvBuf;
    begin
       nvBuf = 300;
       MsiGetProperty(hMSI,'_IsSetupTypeMin', svProperty, nvBuf);
    
    
     
       //Retrieve radio button group property
       if svProperty = 'Complete' then
          MsiSetInstallLevel(hMSI, 150);
       endif;
       if svProperty = 'Minimum' then
          MsiSetInstallLevel(hMSI, 100);
       endif;
       if svProperty = 'Custom' then
          MsiSetInstallLevel(hMSI, 125);
       endif;
    end;

  5. Sequence the custom action accordingly.

    1. Select the Sequences view.

    2. Expand the Installation > User Interface in the center panel.

    3. Locate the CostFinalize action in the list.

    4. Right-click it and choose Move Down until it is located directly after InstallWelcome.

    5. Insert your custom action immediately before CostFinalize by right-clicking on the action before CostFinalize, choosing Insert, and browsing to the custom action.
Was this article helpful? Yes No
No ratings
Version history
Last update:
‎Nov 28, 2007 07:55 PM
Updated by: