Movatterモバイル変換


[0]ホーム

URL:


Skip to main contentSkip to in-page navigation

This browser is no longer supported.

Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.

Download Microsoft EdgeMore info about Internet Explorer and Microsoft Edge
Table of contentsExit editor mode

Environment.OSVersion Property

Definition

Namespace:
System
Assemblies:
netstandard.dll, System.Runtime.dll
Assembly:
System.Runtime.Extensions.dll
Assembly:
mscorlib.dll
Assembly:
netstandard.dll
Source:
Environment.cs
Source:
Environment.cs
Source:
Environment.cs
Source:
Environment.cs

Important

Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.

Gets the current platform identifier and version number.

public: static property OperatingSystem ^ OSVersion { OperatingSystem ^ get(); };
public static OperatingSystem OSVersion { get; }
static member OSVersion : OperatingSystem
Public Shared ReadOnly Property OSVersion As OperatingSystem

Property Value

The platform identifier and version number.

Exceptions

This property was unable to obtain the system version.

-or-

The obtained platform identifier is not a member ofPlatformID

Remarks

Environment.OSVersion returns an OS version that may be incorrect when an application runs under Windows compatibility mode. For more information, seeGetVersionExA function remarks.

In .NET 5 and later versions,Environment.OSVersion returns the actual OS version in compatibility modes specified by theapplication manifest. For more information, seeEnvironment.OSVersion returns the correct operating system version.

To identify the operating system platform, for example, Linux or Windows, you can use theRuntimeInformation.IsOSPlatform method.

Applies to

Collaborate with us on GitHub
The source for this content can be found on GitHub, where you can also create and review issues and pull requests. For more information, seeour contributor guide.

Feedback

Was this page helpful?

YesNoNo

Need help with this topic?

Want to try using Ask Learn to clarify or guide you through this topic?

Suggest a fix?

In this article

Was this page helpful?

YesNo
NoNeed help with this topic?

Want to try using Ask Learn to clarify or guide you through this topic?

Suggest a fix?