Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to get OS' version? #26025

Closed
JanVargovsky opened this issue Apr 28, 2018 · 3 comments
Closed

How to get OS' version? #26025

JanVargovsky opened this issue Apr 28, 2018 · 3 comments
Milestone

Comments

@JanVargovsky
Copy link

Hi,
how do I get correct Windows runtime version that is listed in "winver" command?

when I execute command "winver" it returns "Version 1709 (OS Build 16299.371)"

.NET Core 2.0 app:
System.Environment.OSVersion returns "Microsoft Windows NT 6.2.9200.0"
System.Runtime.InteropServices.RuntimeInformation.OSDescription returns "Microsoft Windows 10.0.16299 "

Do I have to manually extract it form the OSDescription?

Thanks

@JanVargovsky JanVargovsky changed the title How to OS' version? How to get OS' version? Apr 28, 2018
@JanVargovsky
Copy link
Author

Seems like System.Environment.OSVersion is unmaintained (should be Obsolete though).

Alternative is Microsoft.DotNet.PlatformAbstractions.RuntimeEnvironment.OperatingSystemVersion in the Microsoft.DotNet.PlatformAbstractions nuget package.

@SteveL-MSFT
Copy link
Contributor

On Win10, OSVersion for 2.1 returned 10.0.x, however with 3.0, it returns 6.2.x. Although the documentation says it is unreliable, this is a regression and breaking some PSCore6 tests that were relying on this and likely customer scripts as well.

cc @karelz

@karelz
Copy link
Member

karelz commented Jan 10, 2019

@SteveL-MSFT please file a new bug, let's not hijack long-closed issues.
BTW: This is long-term source of pain. It may have been by-design breaking change in an attempt to fix the space ... let's see what area experts say on the new issue.

@msftgits msftgits transferred this issue from dotnet/corefx Jan 31, 2020
@msftgits msftgits added this to the 3.0 milestone Jan 31, 2020
@ghost ghost locked as resolved and limited conversation to collaborators Dec 17, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants