How To: Block Installation Based on OS Version

WiX

How To: Block Installation Based on OS Version

Windows Installer provides the standard VersionNT property that can be used to detect the version of the user's operating system. Often it is desirable to use this property to block installation of an application on incompatible versions of an operating system. The following sample demonstrates how to use this property to block installation of an application on operating systems prior to Windows Vista/Windows Server 2008.

<Condition Message="This application is only supported on Windows Vista, Windows Server 2008, or higher.">
    <![CDATA[Installed OR (VersionNT >= 600)]]>
</Condition>

Installed is a Windows Installer property that ensures the check is only done when the user is installing the application, rather than on a repair or remove. The VersionNT part will pass if the property's value is greater than or equal to 600, the version that matches Windows Vista, the installation will proceed. The values for different versions of the Windows operating system are available on MSDN.

To check for versions of 64-bit Windows use the VersionNT64 property. To check for versions of Windows prior to Windows NT use the Windows9X property.