MSI Factory

Variables

This tab allows you to define build variables that are expanded at the pre-processor stage when building the WiX files which are compiled into the final installer database file. Build variables are not put into the MSI installer, nor do they even exist at runtime. They are just there as placeholders for strings that you want to use in your project. Build variables are expanded as a literal search and replace at built-time.

MSI Factory also contains a number of built-in global build variables. See the Global Build Variables topic for a list of the variables that are available.

Tip: You can also generate setups from the command line without user interaction using MSI Factory's unattended build options.

Defining a Variable

To define a new variable, click the Add button. This will open the New Variable dialog which will allow you to define a new variable.

Changing the Value of a Variable

Simply type the new value of the variable into the edit field beside the variable name in the grid.

Changing the Name of a Variable

To change the name of a variable, select it in the grid and then click the Edit button. This will open the Edit Variable dialog. Note that if you change the name of a variable it will not be updated anywhere that it is in use already in the project. You will have to manually find places that it was used and update the name.

Removing a Variable

To remove a variable, select it in the grid and click the Remove button.

Using a Variable

You can use build variables in any text field in your project by using the syntax:

$(var.VARNAME)

where VARNAME is the name of the variable. So, for example, if you define a variable:

Name: SoftwareVersion

Value: 1.0.7662

You can use it in an edit field using:

$(var.SoftwareVersion)

When your project is built, $(var.SoftwareVersion) will be directly replaced with the text "1.0.7662" (without the quotes).

Tip: You can insert a build variable into most edit fields in the project by right-clicking on the field and choosing Insert > Build Variable from the context menu.

More Information

WiX Help File: Preprocessor