Instructions XML for WinInst Packages
- Updated2025-10-07
- 14 minute(s) read
The optional Instructions XML file you create provides Package Manager with instructions for customized execution of MSIs and executables. WinInst packages without an instructions file run all MSIs in ascending ASCII order by file name.
- <upgrade>
- <msis>
- <returnCodeConventions>
- <customExecutes>
The following text is an example instructions file for a WinInst package.
<instructions>
<msis>
<msi name="Setup.msi">
<property name="ADDLOCAL" value="ALL"/>
<langFile language="de">transform1.mst</langFile>
<langFile language="fr">transform2.mst;transform3.mst</langFile>
<langFile language="ja">transform4.mst</langFile>
<langFile language="ko">transform5.mst</langFile>
<langFile language="zh-CN">transform6.mst</langFile>
</msi>
<msi name="Setup64.msi">
<property name="ADDLOCAL" value="ALL"/>
</msi>
</msis>
</instructions>
<upgrade> Element
The <upgrade> element specifies how a package upgrades a previous version of itself.
The following enum values are valid inside the <upgrade> tags:
| Value | Description | Example |
|---|---|---|
| clean | Package Manager removes the old version of the package before installing the new version of the package. This is the default behavior when the element value is blank. | <upgrade>clean</upgrade> |
| native | Package Manager installs the new version of the package before removing the old version of the package. (The MSI performs its native upgrade behavior.) | <upgrade>native</upgrade> |
<msis> Element
The <msis> element provides a list of MSI files in the package.
<msis> contains the <msi> child element.
Package Manager runs the MSIs in the order in which you include them in the list. If you do not list any MSIs here, Package Manager runs all MSIs in the package data directory in no particular order and without conditions, properties, or transforms.
<msi> Element
The <msi> element represents one MSI in the package, along with conditions for running the MSI, properties to set to the MSI, and transforms to apply to the MSI.
The <msi> element is optional in the Instructions file, but you can include as many as needed for your package. List MSIs using one <msi> element for each MSI. <msi> contains the <property> element.
It has the following attributes:
| Attribute Name | Type | Required | Description | Examples |
|---|---|---|---|---|
| name | String | Yes |
|
<msi name="temp\example.msi"/> |
| condition | WinInst Condition | No |
Note If you specify any condition, property, or command-line in your instructions file, you must declare a dependency on the
ni-msiproperties package of the minimum version that you require.
|
<msi name="example.msi" condition="(VersionNT64 = 601) AND (NIRUNNINGINSILENTMODE)"/> |
| skipUninstall | Boolean | No |
|
<msi name="temp\example.msi" skipUninstall="y"/> |
<property> Element
The <property> element specifies a property (name-value pair) that Package Manager passes to the MSI engine for this MSI.
Refer to Properties and Conditions in WinInst Packages for a list of supported properties, as well as rules and guidelines.
| Attribute Name | Type | Required | Possible Values | Description | Examples |
|---|---|---|---|---|---|
| name | string | Yes | All uppercase string that follows the MSI naming rules for properties. |
Specifies the name of the property that Package Manager passes to the MSI when running it. Note If you specify any condition, property, or command-line in your instructions file, you must declare a dependency on the ni-msiproperties package of the minimum version that you require.
|
<property name="INSTALLLEVEL" value="1000"/> |
| value | WinInst condition | Yes | The value of the property. |
|
<property name="MYLANGCODE" value="[NIPMLANGUAGECODE]"/> |
| step | Enum | No |
|
|
<property name="INSTALLLEVEL" value="1000" step="install"/> |
<langFile> Element
The <langFile> element specifies the transforms to pass to the MSI. You can include multiple transform files for each language by delimiting the transform files with semicolons. The transform files must be in the same directory as the MSI files, and the transform file path is a relative path of the package data directory. For example, if the MSI file path is foo\bar.msi, the transform file path must be foo\transform filename.mst.
| Attribute Name | Type | Required | Possible Values | Description | Examples |
|---|---|---|---|---|---|
| language | Enum | Yes |
|
Specifies the ISO language code of the language in which Package Manager runs. |
|
<returnCodeConventions> Element
The <returnCodeConventions> element provides a list of custom return code conventions for Package Manager to use when performing custom actions for this package.
<returnCodeConventions> is optional in the instructions file, but can contain one or more <returnCodeConvention> child elements.
<returnCodeConvention> Element
The <returnCodeConvention> element defines how to interpret a return code for one or more custom executes in this package.
<returnCodeConvention> can have one or more optional <returnCode> child elements. <returnCode> rules are evaluated in the order they are defined.
| Attribute Name | Type | Value | Examples |
|---|---|---|---|
| name | String | A unique name for this return code convention. A custom execute in this package can use this name in its returnCodeConvention field to associate itself with this return code convention. | <returnCodeConvention name="alwaysReboot" defaultResult="rebootRequired"/> |
| defaultResult | Enum | Indicates the semantic result of a return code that does not
match any existing return code mapping rules.
|
<returnCodeConvention name="ignore" defaultResult="success"/> |
<returnCode> Element
The <returnCode> element defines a return code mapping rule for its parent <returnCodeConvention>.
<returnCode> is an empty element, meaning that it has attributes, but does not contain elements or text content. It has the following attributes:
| Attribute Name | Type | Value | Examples |
|---|---|---|---|
| min | Integer | Indicates the lower bound of a range of return codes this rule matches. May not be combined with the value attribute. | <returnCode min="0" max="1024" result="success"/> |
| max | Integer | Indicates the upper bound of a range of return codes this rule matches. May not be combined with the value attribute. | <returnCode min="-50" max="-1" result="success"/> |
| value | Integer | Indicates a single return code this rule matches. May not be combined with the min or max attributes. | <returnCode value="1641" result="rebootRequired"/> |
| result | Enum | Indicates the semantic result of a return code matching this rule. | <returnCode value="3010" result="rebootRequired"/> |
<customExecutes> Element
The <customExecutes> element provides a list of executables associated with the package.
<customExecutes> contains the <customExecute> child element.
<customExecute> Element
The <customExecute> element provides Package Manager with conditions for running the executable, when to run the executable, arguments to pass to the executable, and how to handle the executable's errors and user interface.
The <customExecute> element is optional in the Instructions file, but you can include as many <customExecute> elements as needed for your package. <customExecute> is an empty element, meaning that it has attributes, but does not contain elements or text content. <customExecute> has the following attributes that tell Package Manager conditions for running the executable:
| Attribute Name | Type | Possible Values | Description | Example |
|---|---|---|---|---|
| step | Enum |
|
Specifies the transaction step during which Package Manager runs
the executable.
Note If you set the value of
inPackage to y, you must set the value of step to
install or omit the attribute. (See the
inPackage attribute below.)
|
<customExecute step="uninstall" exeName="[NIDIR]\actions\executable.exe"/> |
| schedule | Enum |
|
Specifies the relative point within the transaction steps when
Package Manager runs the executable.
Note If you set the value of the
inPackage attribute to y, you must set the value of schedule to pre or post, or omit the attribute. (See the inPackage attribute below.)
|
<customExecute step="install" schedule="post" exeName="[NIDIR]\executable.exe"/> |
| Attribute Name | Type | Possible Value | Description | Example |
|---|---|---|---|---|
| condition | WinInst condition | The condition for the MSI. | Specifies an MSI condition for Package Manager to evaluate
before running the executable.
Note If you specify any condition,
property, or command-line in your instructions file, you must declare a
dependency on the ni-msiproperties package
of the minimum version that you require.
|
<customExecute exeName="[NIDIR]\executable.exe" condition="VersionNT >=600"/> |
| Attribute Name | Type | Possible Values | Description | Example |
|---|---|---|---|---|
| arguments | String | Command line arguments to pass to the executable. | Specifies command line arguments for Package Manager to pass to
the executable.
Note If you specify any condition,
property, or command-line in your instructions file, you must declare a
dependency on the ni-msiproperties package
of the minimum version that you require.
|
<customExecute exeName="[ProgramFilesFolder]\executable.exe" arguments="-listall"/> |
| formatArguments | Boolean |
|
Specifies whether the arguments
attribute contains strings that the MSI engine needs to resolve. If you set the
value of this attribute to y, you must include a
Depends relationship in your control file that
declares a dependency on the ni-msiproperties
package of the minimum version you require. Note If you specify any condition,
property, or command-line in your instructions file, you must declare a
dependency on the ni-msiproperties package
of the minimum version that you require. |
<customExecute exeName="[ProgramFilesFolder]\executable.exe" arguments="[NIDIR]" formatArguments="y"/> |
| exeName | String | The path and file name of the executable. | Specifies the path and the file name of the executable. This
value is case-sensitive.
|
<customExecute exeName="[ProgramFilesFolder]\executable.exe"/> |
| inPackage | Boolean |
|
Specifies whether the executable resides in the package data folder.
|
The following example specifies a relative path to the executable, where executable.exe resides in a subfolder named actions within the package data directory. <customExecute exeName="actions\executable.exe" inPackage="y"/> |
| Attribute Name | Type | Possible Values | Description | Example |
|---|---|---|---|---|
| wait | Boolean |
|
Specifies whether the executable is synchronous, meaning Package
Manager should wait for it to finish before continuing, or asynchronous, meaning
Package Manager should not wait.
|
<customExecute exeName="executable.exe" wait="n"/> |
| ignoreLaunchErrors | Boolean |
|
Specifies whether Package Manager reports an error if it cannot
run or cannot find the executable. If you omit this attribute, Package Manager uses its default value. |
<customExecute exeName="executable.exe" ignoreLaunchErrors="y"/> |
| hideConsoleWindow | Boolean |
|
Specifies whether to hide the console window for console applications.
|
<customExecute exeName="executable.exe" hideConsoleWindow="y"/> |
| returnCodeConvention | String | Must match the name of a predefined convention or a <returnCodeConvention> defined in this package. The
following predefined conventions are available:
|
Indicates how to interpret the return codes the executable returns.
|
<customExecute step="uninstall" exeName="[ProgramFilesFolder]executable1.exe" returnCodeConvention="installer"/> |
Behavior of Executables Scheduled as Postall
For Instructions files in which you include a <customExecute> element where schedule="postall", Package Manager demonstrates specific behaviors that may affect package installation.
The postall value instructs Package Manager to run the executable after completing the installation, reinstallation, and/or removal steps for all packages.
- Package Manager runs postall executables in the specified order of package installation. Dependencies install first.
- If only a postall executable in a package fails, Package Manager considers the package installed.
- When there are multiple packages with postall executables, Package Manager does not run the remaining executables if one of the postall executables fails. Packages are considered installed assuming no other errors occurred during installation.
- If installation of a package fails, either through MSI failure or failure of an executable scheduled as pre or post, Package Manager displays an error message stating that the package failed to install. Next, it runs all the executables from packages installed up to the point where installation failed. Package Manager does not consider the broken package installed and does not run the postall executables of the broken package. All packages installed before the failure occurred remain installed and Package Manager runs the postall executables of these packages.
Properties and Conditions in WinInst Packages
You can use WinInst conditions in <msi> and <customExecute> elements to conditionally execute WinInst MSIs and executable files.
If you specify any condition, property, or command in your instructions file, you must declare a dependency in your package's control file on the ni-msiproperties package. The ni-msiproperties package has dependencies on additional packages:
- ni-euladepot
- ni-mdfsupport
- ni-metauninstaller
- ni-security-update-kb67l8lcqw-killbits
You must include the ni-msiproperties package and its dependencies in the same feed as the package you build. If you have NI software installed on your system, these packages should exist in their default location on your system: %ProgramData%\National Instruments\NI Package Manager\packages. Copy the ni-msiproperties package and its dependencies from this location to the same directory as your package when you build the feed.
Syntax Requirements for WinInst Conditions
WinInst conditions included in <msi> and <customExecute> elements must follow Microsoft's MSI conditional statement syntax.
You must enclose literal text within quotation marks to adhere to Microsoft's conditional statement syntax. The Instructions XML syntax provides two ways of adhering to this requirement:
- Use single quotation marks to delimit the XML string. This allows the use of double quotation marks inside the string. For example: <customExecute condition='IEDETECTED~="Yes" AND VersionNT64 = 601 AND NIRUNNINGINSILENTMODE'/>
- Use the XML escape character for double quotation marks, ", to delimit the literal text in the XML string. With the XML escape character, you can use double quotation marks or single quotation marks to delimit the XML string. For example: <customExecute condition="IEDETECTED~="Yes" AND VersionNT64 = 601 AND NIRUNNINGINSILENTMODE"/>
You must enclose paths with spaces within quotation marks. Single quotation marks are not allowed in the path:
- Use the XML escape character for double quotation marks, ", to enclose path in the XML string. For example: <customExecute exeName=""VC RunTime Installer.exe"" arguments="/q /norestart" inPackage="y"/>
Properties You Can Use in Conditions
When including conditions in a WinInst package, you can use any Windows property or property defined in the ni-msiproperties package.
If you use a property in the arguments attribute of a <customExecute>, you must include a formatArgument attribute and set the value to y. For a comprehensive list of Windows Installer properties, such as ProgramFiles64Folder and DesktopFolder, search for Property Reference at https://msdn.microsoft.com.
You can use the following list of additional Package Manager-specific properties:
- NIINTERNETCONNECTEDTOMICROSOFT = YES (Package Manager uses this value if a connection to http://go.microsoft.com is successful. Otherwise, the value is NO.)
- NIRUNNINGINSILENTMODE = 1 (Package Manager uses this value only when running in silent mode. Otherwise, it leaves the value undefined.)
- NIPKGPROCESSID (The process ID of the current Package Manager process.)
- NIPMLANGUAGECODE (The ISO language code of the language in which Package Manager runs. Possible values: en, de, fr, ko, ja, or zh-CN.)
You can use the <property> element to pass additional Windows properties to each MSI, for example:
- ADDLOCAL = ALL
- INSTALLLEVEL = 100 (You can also enter a value of 1000, which turns on more or all of your features.)
Properties You Cannot Use in Conditions
Do not use properties that exist only inside of your specific MSI.
- Do not use any property that is defined in your MSI's Property table, by AppSearch, or by the Upgrade table.
- Do not use any Feature state, Component state, or File key.
Properties Passed to Every MSI
Package Manager defines and automatically passes some properties to MSIs run from WinInst packages.
Package Manager always passes the following properties to every MSI at install, uninstall, and repair. You do not need to specify these in the instructions file.
- REBOOT = ReallySuppress
- PROMPTROLLBACKCOST = D
- NIRUNNINGINSILENTMODE = 1 (Package Manager uses this value only when running in silent mode. Otherwise, it leaves the value undefined.)
- NIPKGPROCESSID = The process ID of the current Package Manager process.