0

When use Environment.OSVersion.Version.ToString(); on this mode

MessageBox.Show(Environment.OSVersion.Version.ToString()); show the value 6.2 when use ver command on CMD return 6.3

I have Windows 8.1 Professional Edition Original

like this (the messageBox is a RadMessageBox from Telerik Controls): enter image description here

Why?

tshepang
  • 12,111
  • 21
  • 91
  • 136
Federal09
  • 639
  • 4
  • 9
  • 25

4 Answers4

7

This is a feature, not a bug. It is because Windows 8.1 will only report the version as 6.3 to applications which have been specifically targeted to that platform.

See here and here for official documentation.

Jimmy
  • 27,142
  • 5
  • 87
  • 100
6

From the manual;

The OSVersion property reports the same version number (6.2.0.0) for both Windows 8 and Windows 8.1.

In other words, a documented "limitation".

Joachim Isaksson
  • 176,943
  • 25
  • 281
  • 294
4

http://msdn.microsoft.com/en-us/library/windows/desktop/ms724832(v=vs.85).aspx

If you look here you find that it depends on the manifest of your application. Look at the star point :)

Softwarehuset
  • 815
  • 4
  • 10
-1

I have used this method!

RegistryKey key2 = RegistryKey.OpenRemoteBaseKey(RegistryHive.LocalMachine, "");
                RegistryKey subkey2 = key2.OpenSubKey("SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion");
                string value = subkey2.GetValue("CurrentVersion").ToString();
                if (value == "6.3")
Federal09
  • 639
  • 4
  • 9
  • 25
  • 1
    This method is wrong. It depends on something that is subject to change in the future without notice. You should be using the documented API for retrieving version information (and reading the documentation about it). – Ken White Jan 01 '14 at 02:27