How do I install resources based on the Operating System version?

ImportantThe following article uses options that are available starting with the Professional edition and project type.

A complete installation package should be able to install an application on any version or type of Windows Operating System. Since the application or installation may use different resources or custom actions, you need to condition them based on the OS. This way, the installation package will only install the resources that meet the OS condition.

1. VersionNT

  • VersionNT - this property is set to the version number for the NT operating systems. The values of the VersionNT property are:
    • 501 for Windows XP
    • 502 for Windows Server 2003
    • 600 for Windows Vista and Windows Server 2008
    • 601 for Windows 7 and Windows Server 2008 R2
    • 602 for Windows 8 and Windows Server 2012
    • 603 for Windows 8.1 and Windows Server 2012 R2
    • 1000 for Windows 10 and Windows Server 2016

2. VersionNT64

VersionNT64 - this property is set to the version number for the operating system only if the system is running on a 64-bit computer (it is empty if the package runs on a non-64 bit computer).

NoteIf you need to know the exact number of the service pack installed, you can use the ServicePackLevel property. Windows Installer sets this property to the numerical value of the operating system service pack level if one is installed.

3. MsiNTProductType

MsiNTProductType - this property indicates the Windows product type. The values are:

  • 1 for workstations
  • 2 for domain controllers
  • 3 for servers

4. Examples of using VersionNT, VersionNT64 and MsiNTProductType properties:

4.1 Install a component or run a custom action based on a specific Windows version

For the installation of a component you can set the Condition field in the Component Properties page to the VersionNT property. The same condition can be set for a custom action in the Expression field of the Custom Action Properties page.

OS32-bit64-bit
Windows XPVersionNT = 501VersionNT64 = 502
Windows Server 2003VersionNT = 502VersionNT64 = 502
Windows VistaVersionNT = 600 AND MsiNTProductType = 1VersionNT64 = 600 AND MsiNTProductType = 1
Windows Server 2008VersionNT = 600 AND MsiNTProductType <> 1VersionNT64 = 600 AND MsiNTProductType <> 1
Windows 7VersionNT = 601 AND MsiNTProductType = 1VersionNT64 = 601 AND MsiNTProductType = 1
Windows Server 2008 R2-VersionNT64 = 601 AND MsiNTProductType <> 1
Windows 8VersionNT = 601 AND MsiNTProductType = 1VersionNT64 = 601 AND MsiNTProductType = 1
Windows Server 2012-VersionNT64 = 602 AND MsiNTProductType <> 1
Windows 8.1VersionNT = 603 AND MsiNTProductType = 1VersionNT64 = 603 AND MsiNTProductType = 1
Windows Server 2012 R2-VersionNT64 = 603 AND MsiNTProductType <> 1
Windows 10VersionNT = 1000 AND MsNTProductType = 1VersionNT64 = 1000 AND MsiNTProductType = 1
Windows Server 2016-VersionNT64 = 1000 AND MsiNTProductType <> 1

4.2 Install a component or run a custom action based on the Windows OS type (32-bit or 64-bit)

This can be done by using the VersionNT64 property in the "Condition" field for a component or the "Expression" field for a custom action.

If the component (or custom action) should be installed (or run) only on a 32-bit system, the condition is:

NOT VersionNT64

If the component (or custom action) should be installed (or run) only on a 64-bit system, the condition is:

VersionNT64