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

Update docs for Environment.Version #5196

Merged
merged 6 commits into from
Mar 10, 2021
Merged
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 8 additions & 6 deletions xml/System/Environment.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2493,21 +2493,23 @@ The following example creates environment variables for the <xref:System.Environ
<ReturnType>System.Version</ReturnType>
</ReturnValue>
<Docs>
<summary>Gets a version consisting of the major, minor, build, and revision numbers of the common language runtime.</summary>
<value>The version of the common language runtime.</value>
<summary>Gets a version consisting of the major, minor, build, and revision numbers of the Common Language Runtime.</summary>
<value>The version of the Common Language Runtime.</value>
<remarks>
<format type="text/markdown"><![CDATA[

## Remarks
For the .NET Framework Versions 4, 4.5, 4.5.1, and 4.5.2, the <xref:System.Environment.Version%2A?displayProperty=nameWithType> property returns a <xref:System.Version> object whose string representation has the form `4.0.30319.xxxxx`. For the .NET Framework 4.6 and later versions, it has the form `4.0.30319.42000`.
For .NET Core 3.x and .NET 5+, the <xref:System.Environment.Version%2A?displayProperty=nameWithType> property returns the .NET runtime version number.

For the .NET Framework Versions 4, 4.5, 4.5.1, and 4.5.2, the <xref:System.Environment.Version%2A?displayProperty=nameWithType> property returns a <xref:System.Version> object whose string representation has the form `4.0.30319.xxxxx`. For the .NET Framework 4.6 and later versions, and .NET Core versions before 3.0, it has the form `4.0.30319.42000`.

> [!WARNING]
> For the .NET Framework 4.5 and later, we do not recommend using the <xref:System.Environment.Version%2A> property to detect the version of the runtime; instead, you can determine the version of the common language runtime by querying the registry. For more information, see [How to: Determine Which .NET Framework Versions Are Installed](/dotnet/framework/migration-guide/how-to-determine-which-versions-are-installed).
> For the .NET Framework 4.5 and later, we do not recommend using the <xref:System.Environment.Version%2A> property to detect the version of the runtime; instead, you can determine the version of the Common Language Runtime by querying the registry. For more information, see [How to: Determine Which .NET Framework Versions Are Installed](/dotnet/framework/migration-guide/how-to-determine-which-versions-are-installed).
gewarren marked this conversation as resolved.
Show resolved Hide resolved

For more information about the version of the common language runtime that is installed with each version of the .NET Framework, see [Versions and Dependencies](/dotnet/framework/migration-guide/versions-and-dependencies).
For more information about the version of the Common Language Runtime that is installed with each version of the .NET Framework, see [Versions and Dependencies](/dotnet/framework/migration-guide/versions-and-dependencies).

## Examples
The following example displays the version of the common language runtime. (The version is omitted from the example output for security reasons.)
The following example displays the version of the Common Language Runtime.

[!code-cpp[Environment.Version#1](~/samples/snippets/cpp/VS_Snippets_CLR/Environment.Version/CPP/version.cpp#1)]
[!code-csharp[Environment.Version#1](~/samples/snippets/csharp/VS_Snippets_CLR/Environment.Version/CS/version.cs#1)]
Expand Down