Jeroen Mostert
10/27/2008 6:06:00 PM
mohandasg@gmail.com wrote:
> 'Environment.OSVersion' can be used to find OS version. However how to
> differentiate between windows XP (64 bit) and a windows 2K3 ? both
> shows major version 5 and minor version 2 .
> Also how to differentiate between Vista and windows 2K8?
>
You can't do this using Environment. You can do it by P/Invoke to
GetVersionEx(): wProductType will be VER_NT_WORKSTATION for XP and Vista and
VER_NT_SERVER for the server editions. Google around, there are a few samples.
Ask yourself whether you really need to do this -- the reason the version
numbers are identical is that the kernels are identical, so the OSes are so
much alike that it should make no difference for most applications. An
installer might need to know this, but installers typically aren't written
as .NET applications (for one thing, you have to make sure .NET is installed
before you can use the installer, which is a bit silly...)
--
J.