A lot of applications use different files or registry entries on different Windows versions. If you want your installer to handle all situations, you need to include the resources for all Windows versions and condition their installation.
This can be done by conditioning the package components (from Component) table with VersionNT or VersionNT64 installer properties. These properties are set automatically by Windows Installer based on the Windows version.
Some newer versions (for example Windows Vista and Windows Server 2008) use the same value for these properties. In this case you can differentiate them through WindowsBuild property.
A further differentiation can be made through ServicePackLevel and MsiNTProductType properties. ServicePackLevel is the actual service pack number and can be “1″, “2″ etc.
Here is a list with possible values for VersionNT, VersionNT64 and WindowsBuild:
| Windows version | VersionNT / VersionNT64 | WindowsBuild |
|---|---|---|
| Windows 2000 | 500 | 2195 |
| Windows XP | 501 | 2600 |
| Windows Server 2003 | 502 | 3790 |
| Windows Vista | 600 | 6000 |
| Windows Vista SP1 | 600 | 6001 |
| Windows Vista SP2 | 600 | 6002 |
| Windows Server 2008 | 600 | 6001 |
| Windows Server 2008 SP2 | 600 | 6002 |
| Windows 7 | 601 | 7100 |
| Windows 7 SP1 | 601 | 7601 |
| Windows Server 2008 R2 | 601 | 7100 |
| Windows Server 2008 R2 SP1 | 601 | 7601 |
MsiNTProductType can have the following values:
| MsiNTProductType value | Description |
|---|---|
| 1 | A workstation machine which doesn't use a Windows Server OS. This means it's Windows 7 and not Windows Server 2008 R2. |
| 2 | A domain controller machine which uses a Windows Server OS. This means it's Windows Server 2008 R2 and not Windows 7. |
| 3 | A Windows Server machine. This means it's Windows Server 2008 R2 and not Windows 7. |
Some sample conditions:
| Windows version | Condition |
|---|---|
| Windows 7 SP1 | (VersionNT = "601") AND (ServicePackLevel = "1") AND (WindowsBuild >= "7601") AND (MsiNTProductType = "1") |
| Windows 7 | (VersionNT = "601") AND (WindowsBuild >= "7100") AND (MsiNTProductType = "1") |
| Windows 7 x64 | (VersionNT64 = "601") AND (WindowsBuild >= "7100") AND (MsiNTProductType = "1") |
| Windows Server 2008 R2 SP1 | (VersionNT = "601") AND (ServicePackLevel = "1") AND (WindowsBuild >= "7601") AND (MsiNTProductType <> "1") |
| Windows Server 2008 R2 | (VersionNT = "601") AND (WindowsBuild >= "7100") AND (MsiNTProductType <> "1") |
| Windows Server 2008 R2 x64 | (VersionNT64 = "601") AND (WindowsBuild >= "7100") AND (MsiNTProductType <> "1") |
| Windows Vista SP2 | (VersionNT = "600") AND (ServicePackLevel = "2") AND (WindowsBuild = "6002") AND (MsiNTProductType = "1") |
| Windows Vista SP1 | (VersionNT = "600") AND (ServicePackLevel = "1") AND (WindowsBuild >= "6001") AND (MsiNTProductType = "1") |
| Windows Vista | (VersionNT = "600") AND (WindowsBuild >= "6000") AND (MsiNTProductType = "1") |
| Windows Vista x64 | (VersionNT64 = "600") AND (WindowsBuild >= "6000") AND (MsiNTProductType = "1") |
| Windows Server 2008 SP2 | (VersionNT = "600") AND (ServicePackLevel = "2") AND (WindowsBuild >= "6002") AND (MsiNTProductType <> "1") |
| Windows Server 2008 | (VersionNT = "600") AND (WindowsBuild >= "6001") AND (MsiNTProductType <> "1") |
| Windows Server 2008 x64 | (VersionNT64 = "600") AND (WindowsBuild >= "6001") AND (MsiNTProductType <> "1") |
| Windows XP SP3 | (VersionNT = "502") AND (ServicePackLevel = "3") |
| Windows XP x64 | (VersionNT64 = "502") |