Sample Application: InstallScript MSI


InstallShield allows creating windows setup. It allows creating custom setup using components and features. It allows customizing UI flow, installing logic and customizing UI theme for the setup.

How to create InstallShield project?

To create New InstallShield project, open InstallShield 2011 and select File menu → new. It will open new project dialog.

Select Windows Installer tab. Select InstallScript MSI project. Specify the project name and location of the project on the disk. Click OK. It will create TestProject and show you Project Assistant window.

The project assistant allows you to configure settings as I have highlighted in the image. Click on Application Information to configure application information for the project.

Application Information:

The application information will allow you to set basic information for the setup. It includes company name, application name, application version and company web address. It also allows specifying setup icon.

Now click on Application Requirement. The application requirement tab allows configuring dependencies of the application. It allows selecting OS dependencies and software dependencies of your application.

If your application has any OS dependencies then select Yes in first box and select required Operating Systems from the box under it.

If your application has any software dependencies then select Yes in Second box. Then select the software dependencies of your application below it.

Now click on Installation Architecture tab. It will allow you customize your application with customized architecture.

Now Click on Application Files. It allows specifying files you would like to put on destination machine. It also allows using special folders of Operating System.

The Application tab allows you to configure files you would like to add into the install. It allows you to change the location of your application on the target machine. By default, it installs the application in ProgramFiles\<CompanyName>\<ApplicationName>. You can change it according to requirement. You can add files to folder by clicking Add Files and select the files you would like to include in setup.

If you need any special folder (e.g. Fonts folder) then right click on Destination Computer and hover to Show predefined folder. It will show all predefined folders of Operating System. Then select the folder you would like to show.

For example, if your application needs additional fonts and you would like to add those fonts to destination machine then select Fonts folder and add the font files to that folder.

You can configure location of specific feature. To configure location of the feature, select the feature from All Application data drop down and configure it as required.

Now click on Installation Designer to design your setup. The installation designer allows you to customize and configure setup for your application.

In above image, select the General Information under Installation information in the left pane. It will show you general properties of the setup project shorted by category by default. You can change sort order to alphabetically.

There are 3 categories for General information properties. 1) General 2) Summary Information Stream 3) Add or Remove Programs.

The General categories show basic properties used for the project.

Project file Name: It is read only property. It shows the full path of the install shield project.

Project File Format: it defines format of the project file. It could be Binary (default) or XML.

Setup Language: It defines setup language for the user. You can select multiple languages.

Default Language: Specifies default language from the selected languages.

Enable Maintenance: It specifies that application allows you to modify features after the install or not? If yes then the user can modify features from control panel.

Product Name: Specifies Name of the product. You can identify the product in add/remove programs using the same product name.

Product Version: Version of the product.

INSTALLDIR: Specifies installation directory where the application will be installed. For eg. [ProgramFilesFolder]TestCompany\TestProject. The [ProgramFilesFolder] will be replaced by ProgramFilesFolder path of the operating system.

The summary information category allows you to specify following properties.

Author: Author of the setup.

Keywords: List of keywords separated by comma for the setup.

Template Summary: It specifies the supporting processor type and default language of the setup. It accepts value like Intel; 1033. The Intel specifies x86 processor and the 1033 specifies English language. Valid processor values includes

ñ Alpha (Alpha is supported by Windows Installer 1.0 only.)

ñ Intel

ñ Intel64 (Intel64 is supported by Windows Installer 2.0 only.)

ñ x64

The Add or Remove Programs category properties allow you specify options available in add/remove programs after installation.

Display Icon: Specifies icon file that will be displayed in add/remove programs when you installs the application.

Disable Change button: Specifies that user will have an option to change the features of the application in add/remove programs.

Disable Remove button: Specifies that user will have an option to remove the application in add/remove programs.

Publisher: Publisher of the application

Publisher URL: Publisher web address.

There are two main perspectives in an installation project—that of the developer and that of the end user. In InstallShield, these perspectives are addressed in detail in the Components and Features views, respectively.


Components represent the developer’s view of the product. They are installation authoring tools that help the developer organize similar application data—such as files, registry entries, and shortcuts—into logical groups.

To enable the end user to choose which features to install, you should divide your application into components that correspond with the features of your application.


Features are the building blocks of an application from the end user’s perspective. Each feature represents a specific piece of functionality for your product—such as the help files. End users should be able to install and uninstall discrete features of your product.

For example, an end user with limited hard drive space could elect not to install a product tutorial. If the user subsequently purchases another computer or frees resources on an existing one, the previously uninstalled product tutorial could then be installed.

You should separate your application into features that correspond to the components of your application.

To define components of setup, select Components under Organizationfolder in installation designer.

By default, the setup has Default Component. You can add additional components in the system.

For example, if my application has two modules, 1) Client 2) Admin. In that case, I can add 3 components 1) Client 2) Admin and 3) Shared.

Client component will hold files, registry settings and short cuts for the client components.

To add new component, right click on Components and select New Component. It will add new component to components list. Rename the component and name it to Client.

Now expand the client component. A component will have 4 child nodes.

Select the Files node. It will show you files content pane. To add files to the component, right click on content pane and select Add… Select the files you would like to include for the component. The files might be an executable, a dependent assemblies etc.

To include registry settings for specific components, select Registry Data. It will show you source and destination computer registry. You can configure registry settings for the components. If the client component requires and registry setting, you can create required registry settings.

For example, if you would like to add key named “Client” under HKEY_LOCAL_MACHINE\Software then right click on HKLM and select New → Key and key name “Software”. Now right click on Software and select New → Key and specify key name “Client”. Now you can add any settings under client key.

In Shortcuts, you can add required shortcuts for the components.

Same way, you can create Admin & Shared components. The shared components will hold all the files those are used in both components.

Now select Features under Organization in installation designer. By default, Setup has DefaultFeatureadded. So you can remove the feature and add features according to your requirements.

For example, if your application has two features 1) Admin 2) Client then creates two features named Admin and Client and change its Display Name accordingly. The display name property specify the name of feature displayed to the user while installation.

Now you need to assign components to the feature. So it will installs components assigned to the features selected by the user.

To assign components to feature, select Setup Design under Organizationin installation designer.

In setup design, select the feature you would like to assign components. Right click the feature and select “Associate Components”. It will show associate components dialog with list of available components. Select components you would like to associate with the feature. You can select multiple components using Ctrl key. Click Ok to associate components with the feature.

In my example, I have added 2 features and associated 2 components.

In my example, I have added 2 features with 2 associated components with them. In Admin feature, I have associated Admin and Default component. In Client feature, I have associated Client and Default component.

InstallShield also allows you to show custom dialog during setup process. To create new dialog, select Dialogs under User Interfacein installation designer.

It will show available dialogs in InstallShield. You can also create custom dialogs.

To create custom dialog, right click on All Dialogs and select New Dialog. It will add new dialog to dialog list. Rename the dialog as required. To edit the dialog, select the dialog and click Edit Dialog.

It will show the dialog design and edit. You can put new controls using the toolbar.

This toolbar will automatically show up when you click edit dialog.

Now, if you would like to customize control of the setup then you need to create installscript. The InstallScript is same like VBScript. To open InstallScript, select InstallScript under Behavior and Logic in installation designer. It will open the installscript. By default, it shows default setup.rulinstallscript file. You may add multiple files as required.

I have added registration.rul for registration purpose.

All the functions used in script will be displayed under Functions node.




// File Name: Setup.rul


// Description: Blank setup main script file


// Comments: Blank setup is an empty setup project. If you want to

// create a new project via. step-by step instructions use the

// Project Assistant.



// Included header files —————————————————-

#include “ifx.h”

#include “Registration.rul” //Include Registration.rul file

// Note: In order to have your InstallScript function executed as a custom

// action by the Windows Installer, it must be prototyped as an

// entry-point function.

// The keyword export identifies MyFunction() as an entry-point function.

// The argument it accepts must be a handle to the Installer database.

/* export prototype MyFunction(HWND); */


// OnMoved


// The OnMoved event is called just before the InstallShield action

// ‘GeneratedMSIScript’ is executed.


function OnMoved() //Executed when file process progress completed.

// Declaration

NUMBER nResult, szReturn;

STRING szDllName, szClass;

OBJECT objLicensing;


if (!MAINTENANCE) then

// non-maintenance code

//Use external DLL.

szDllName= SUPPORTDIR ^ “TestSecurityHelper.dll”;


if (szReturn <0 ) then

MessageBox(“Failed to load dll.”, SEVERE);


//Class name to use.



//create object of TestLicensing.

set objLicensing= DotNetCoCreateObject(szDllName,szClass,””);

MessageBox(“Licensing object created”,INFORMATION);

if(!objLicensing.IsRegistered()) then





MessageBox(“Error using custom DLL”, SEVERE);





// OnFilterComponents


// The OnFilterComponents event is called by the framework to filter out

// components in each feature by language and platform, override this

// event to perform custom filtering.


// Note: This event will not be called automatically in a

// program…endprogram style setup.


function OnFilterComponents()

number nResult;

string szInstall;


// Filter file groups by current platform.

FeatureFilterOS(MEDIA, 0, ISOSL_ALL, TRUE);


// Filter file groups by current language.

FeatureFilterLanguage(MEDIA, ISLANG_ALL, TRUE);




Note: This application is created for reference only. May be some functionality cannot work in your solution. Its not our responsibility if any written feature/code not working with your solution.

Specially Thanks: Bhavesh S.


About Vijay Modi

Having 12+ years of experience in web application development. Expertise in various domains like E-Commerce, E-Learning, Insurance. I have expertise in web application development, window application development, Performance improvement, bug fixing etc. I am believing in quality work and achieving deadlines. Also like to work on new technologies and quick learner.
This entry was posted in Setup and Deployment. Bookmark the permalink.

3 Responses to Sample Application: InstallScript MSI

  1. rajeswari says:

    nice explanation…..
    i want install script code for displaying a dialogue

  2. Sunil Y says:

    Thanks for your explanation Bhavesh.,

    Can you please provide your suggestion about how to use conditional components in installshield.
    …like i want to copy folder in directory when it meet the condition.
    I have used in install script is…….

    if( szDataAccessServiceFlag = “True” ) then
    FeatureSetTarget(MEDIA, “”, szSrvcDASPath);
    FeatureSetTarget(MEDIA, “”, “”);

    But this will copy the files at c drive, Can you please put your through…

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s