The Difference between a Public MSI Property and a Global InstallScript Variable

The Difference between a Public MSI Property and a Global InstallScript Variable

Summary:

This article discusses the difference between a public MSI property and a global InstallScript variable.

Public Property (Basic MSI Project):

Public properties have names that contain only uppercase letters. For example, INSTALLDIR is a public property. Public properties can be specified at the command line used to launch the installation or chosen by using an authored user interface. If you are creating your own properties, use all uppercase letters if you want end-users to have access to these properties.

In order to allow the end-user or administrator to change the destination via the user interface or from the command line, the Directory Identifier for the component’s destination must be a public property.

Note: Only public properties have their values preserved from an installation’s user interface and User Interface Sequence to the point where the installation is changing the target system, known as the Execute Sequence. If you set the value of a property in a dialog box displayed to the end-user, use a public property (for example, MY_PUBLIC_PROPERTY) if you want its value written to a file or to the Windows Registry.

The value of a public property is passed on from the User Interface Sequence (in which the dialogs are shown) to the Execute Sequence (in which the system is modified). Additionally, only public properties can be specified at the command line as parameters passed to msiexec.exe which is the main executable for running an MSI (Windows Installer) package.

Therefore, make sure that you use a public property to store the value for a UI control (EditBox, ComboBox, etc.) if you want its value to be available in the Execute Sequence, for instance, if the value of this property is written to the Windows Registry.

Global Variable (InstallScript Project):

A global variable in the program is a variable defined outside the subroutine or function. It has a global scope means it holds its value throughout the lifetime of the program. Hence, it can be accessed throughout the program by any function defined within the program, unless it is shadowed. If you want to use the global variable in another .rul file, you have to include the .rul file which declares the global variable.

Global Variable (InstallScript MSI Project):

OnFirstUIAfter is called by the InstallScript engine after the MSI finishes, so you can't access MSI properties with public properties. It's possible with setting a global variable in OnFirstUIBefore and using that in OnFirstUIAfter.

Was this article helpful? Yes No
No ratings
Version history
Revision #:
8 of 8
Last update:
‎Feb 12, 2021 09:55 AM
Updated by: