About Windows Installer, the .NET Framework, and Visual Studio.
Microsoft Windows provides a lot of base services on which applications can
be written, but there are differences between all the various editions of
Windows. While it's far more common to have a minimum dependency on a particular
platform, cases may arise where an application may require, for example, Windows
XP but won't run on Windows Server 2003. The recent release of
Explorer 7.0 Beta 2 Preview is one such example, requiring Windows XP SP2.
While ultimately you should use the
AppSearch table and related tables like the
DrLocator table for finding directories and files, along with the
Signature table for detecting versions of files, validating a particular
platform may be good enough in support scenarios.
If you have an application that will only run in
Windows XP and
64-bit but won't run in
Windows Server 2003 SP1 64-bit you'll find that the
VersionNT property for both of the latter 64-bit platforms is the same
value: 502. The same is true for the
that is set only on 64-bit platforms. What's more is that the
WindowsBuild property and
ServicePackLevel property for both 64-bit editions of Windows XP and Windows
Server 2003 is the same: 3790 and 1, respectively. Now what?
Fortunately there's the
MsiNTProductType property defined for NT platforms with Windows Installer
2.0 and later. For Windows XP which is a workstation platform, this value will
be 1. For Windows Server 2003 this value will be 2 for a domain controller, and 3 for a server edition.
Since, from the
Installer Supportability matrix, Windows XP RTM ships with Windows Installer
2.0 rest assured that this property will be defined for this scenario. So if you only wanted your application to
install on Windows XP editions you could add the following condition to your
VersionNT = 501 OR (VersionNT64 = 502 AND MsiNTProductType = 1)
These values corresponds to the values for the
obtained from the native
GetVersionEx function. There are more
properties that correspond to other fields in the OSVERSIONEX structure you can use in Windows Installer as well.
Nearly all links on this page are dead.
The last paragraph for example, should be updated to ...
OSVERSIONEX.wProductType = msdn.microsoft.com/.../ms724833(v=vs.85).aspx
Operating system properties: msdn.microsoft.com/.../aa370556(v=vs.85).aspx