Resolving Variables at Build Time

InstallAnywhere 2021

You can configure your project to use build-time variables, which are variables that have their values set at build time.

Instead of using the dollar symbol ($) as the variable delimiter (which is used for standard variables, such as $var$), use the at symbol (@) as the delimiter for build-time variables, such as @var@.

Important:InstallAnywhere does not have support for resolving build-time variables for any of the properties in the Build Appliances view on the Build page.

Configuring Build-Time Variables in the Advanced Designer

To configure build-time variables in the Advanced Designer:

1. In the Advanced Designer, on the Project page, click Variables. The Variables view opens.
2. Click the Build Time Variables button. The Build Time Variables dialog box opens.
3. Click the Edit Variables button. The Edit Build Time Variables dialog box opens.
4. Click the Add button. InstallAnywhere adds a new row to the list of variables.
5. In the Build Time Variable column of the new row, enter a name for the new variable, such as @Apple@.
6. In the corresponding Value column, enter the value for the new variable.
7. Click OK. The Edit Build Time Variables dialog box closes. The new build-time variable is now listed on the Build Time Variables dialog box.
8. Click OK.

The Build Time Variables dialog box closes.

Configuring Build-Time Variables Using a Property File

You can also define build-time variables in a property file (.properties) and specify this property file during the command-line build. This method enables you to update variables just before build by editing the property file.

To specify the properties file that you want to use, pass the full path and file name to build.exe through the -btv parameter; for example:

build.exe "C:\Projects\My_Project.iap_xml" -btv "C:\Properties\mypropertyfile.properties"

If the same variable is present in the both the property file and in the Advanced Designer, the variable that is defined in the property file overrides the variable that is defined in the Advanced Designer.

To add a build-time variable named version with a value of 8.4.0.1 to a build-time .properties file, add the following line to the .properties file:

version=8.4.0.1

Note:When using a .properties file to define Build-Time Variables, make sure not to use the IA_BTV_ prefix in the Build-Time Variable name. For example, use PATH, not IA_BTV_PATH. The IA_BTV_ prefix is intended only for setting a Build-Time Variable with an environment variable. Also, when setting a Build-Time Variable to a directory path, make sure to escape a \ backslash with another \ backslash. For example use PATH=C:\\Users\\JoeSmith and not PATH=C:\Users\JoeSmith.

Defining Build-Time Variables as Environmental Variables

You can also define environment variables and use them as build-time variables in your project.

To define build-time variables as environmental variables, use the prefix IA_BTV_ in the name of the environment variables—for example, IA_BTV_VariableName (or @IA_BTV_VariableName@). InstallAnywhere lists such environment variables in the Build Time Variables dialog box, which opens when you click the Build Time Variables button in the Variables view. This dialog box lists the variable name without the IA_BTV_ prefix.

See Also