This article explains the policies used by the .NET tools, SDK, and runtime for selecting versions. These policies provide a balance between running applications using the specified versions and enabling ease of upgrading both developer and end-user machines. These policies enable:
Easy and efficient deployment of .NET, including security and reliability updates.
Use the latest tools and commands independent of target runtime.
Version selection occurs:
When you run an SDK command, the SDK uses the latest installed version.
When you build an assembly, target framework monikers define build time APIs.
When you run a .NET application, target framework dependent apps roll-forward.
When you publish a self-contained application, self-contained deployments include the selected runtime.
The rest of this document examines those four scenarios.
The SDK uses the latest installed version
SDK commands include dotnet new and dotnet run. The .NET CLI must choose an SDK version for every dotnet command. It uses the latest SDK installed on the machine by default, even if:
The project targets an earlier version of the .NET runtime.
The latest version of the .NET SDK is a preview version.
You can take advantage of the latest SDK features and improvements while targeting earlier .NET runtime versions. You can target different runtime versions of .NET using the same SDK tools.
On rare occasions, you may need to use an earlier version of the SDK. You specify that version in a global.json file. The "use latest" policy means you only use global.json to specify a .NET SDK version earlier than the latest installed version.
global.json can be placed anywhere in the file hierarchy. The CLI searches upward from the project directory for the first global.json it finds. You control which projects a given global.json applies to by its place in the file system. The .NET CLI searches for a global.json file iteratively navigating the path upward from the current working directory. The first global.json file found specifies the version used. If that SDK version is installed, that version is used. If the SDK specified in the global.json isn't found, the .NET CLI uses matching rules to select a compatible SDK, or fails if none is found.
The following example shows the global.json syntax:
{ "sdk": { "version": "5.0.0" }}
The process for selecting an SDK version is:
dotnet searches for a global.json file iteratively reverse-navigating the path upward from the current working directory.
dotnet uses the SDK specified in the first global.json found.
dotnet uses the latest installed SDK if no global.json is found.
For more information about SDK version selection, see the Matching rules and rollForward sections of the global.json overview article.
Target Framework Monikers define build time APIs
You build your project against APIs defined in a Target Framework Moniker (TFM). You specify the target framework in the project file. Set the TargetFramework element in your project file as shown in the following example:
<TargetFramework>net5.0</TargetFramework>
You may build your project against multiple TFMs. Setting multiple target frameworks is more common for libraries but can be done with applications as well. You specify a TargetFrameworks property (plural of TargetFramework). The target frameworks are semicolon-delimited as shown in the following example:
A given SDK supports a fixed set of frameworks, capped to the target framework of the runtime it ships with. For example, the .NET 5 SDK includes the .NET 5 runtime, which is an implementation of the net5.0 target framework. The .NET 5 SDK supports netcoreapp2.0, netcoreapp2.1, netcoreapp3.0, and so on, but not net6.0 (or higher). You install the .NET 6 SDK to build for net6.0.
.NET Standard
.NET Standard was a way to target an API surface shared by different implementations of .NET. Starting with the release of .NET 5, which is an API standard itself, .NET Standard has little relevance, except for one scenario: .NET Standard is useful when you want to target both .NET and .NET Framework. .NET 5 implements all .NET Standard versions.
For more information, see .NET 5 and .NET Standard.
Framework-dependent apps roll-forward
When you run an application from source with dotnet run, from a framework-dependent deployment with dotnet myapp.dll, or from a framework-dependent executable with myapp.exe, the dotnet executable is the host for the application.
The host chooses the latest patch version installed on the machine. For example, if you specified net5.0 in your project file, and 5.0.2 is the latest .NET runtime installed, the 5.0.2 runtime is used.
If no acceptable 5.0.* version is found, a new 5.* version is used. For example, if you specified net5.0 and only 5.1.0 is installed, the application runs using the 5.1.0 runtime. This behavior is referred to as "minor version roll-forward." Lower versions also won't be considered. When no acceptable runtime is installed, the application won't run.
A few usage examples demonstrate the behavior, if you target 5.0:
✔️ 5.0 is specified. 5.0.3 is the highest patch version installed. 5.0.3 is used.
❌ 5.0 is specified. No 5.0.* versions are installed. 3.1.1 is the highest runtime installed. An error message is displayed.
✔️ 5.0 is specified. No 5.0.* versions are installed. 5.1.0 is the highest runtime version installed. 5.1.0 is used.
❌ 3.0 is specified. No 3.x versions are installed. 5.0.0 is the highest runtime installed. An error message is displayed.
Minor version roll-forward has one side-effect that may affect end users. Consider the following scenario:
The application specifies that 5.0 is required.
When run, version 5.0.* isn't installed, however, 5.1.0 is. Version 5.1.0 will be used.
Later, the user installs 5.0.3 and runs the application again, 5.0.3 will now be used.
It's possible that 5.0.3 and 5.1.0 behave differently, particularly for scenarios like serializing binary data.
Control roll-forward behavior
The roll-forward behavior for an application can be configured in four different ways:
Project-level setting by setting the <RollForward> property:
This file is produced when you compile your application. If the <RollForward> property was set in the project, it's reproduced in the *.runtimeconfig.json file as the rollForward setting. Users can edit this file to change the behavior of your application.
The dotnet command's --roll-forward <value> property.
When you run an application, you can control the roll-forward behavior through the command line:
dotnet run --roll-forward LatestMinordotnet myapp.dll --roll-forward LatestMinormyapp.exe --roll-forward LatestMinor
The DOTNET_ROLL_FORWARD environment variable.
Precedence
Roll forward behavior is set by the following order when your app is run, higher numbered items taking precedence over lower numbered items:
First the *.runtimeconfig.json config file is evaluated.
Next, the DOTNET_ROLL_FORWARD environment variable is considered, overriding the previous check.
Finally, any --roll-forward parameter passed to the running application overrides everything else.
Values
However you set the roll-forward setting, use one of the following values to set the behavior:
Value
Description
Minor
Default if not specified. Roll-forward to the lowest higher minor version, if requested minor version is missing. If the requested minor version is present, then the LatestPatch policy is used.
Major
Roll-forward to the next available higher major version, and lowest minor version, if requested major version is missing. If the requested major version is present, then the Minor policy is used.
LatestPatch
Roll-forward to the highest patch version. This value disables minor version roll-forward.
LatestMinor
Roll-forward to highest minor version, even if requested minor version is present.
LatestMajor
Roll-forward to highest major and highest minor version, even if requested major is present.
Disable
Don't roll-forward, only bind to the specified version. This policy isn't recommended for general use since it disables the ability to roll-forward to the latest patches. This value is only recommended for testing.
Self-contained deployments include the selected runtime
You can publish an application as a self-contained distribution. This approach bundles the .NET runtime and libraries with your application. Self-contained deployments don't have a dependency on runtime environments. Runtime version selection occurs at publishing time, not run time.
The restore event that occurs when publishing selects the latest patch version of the given runtime family. For example, dotnet publish will select .NET 5.0.3 if it's the latest patch version in the .NET 5 runtime family. The target framework (including the latest installed security patches) is packaged with the application.
An error occurs if the minimum version specified for an application isn't satisfied. dotnet publish binds to the latest runtime patch version (within a given major.minor version family). dotnet publish doesn't support the roll-forward semantics of dotnet run. For more information about patches and self-contained deployments, see the article on runtime patch selection in deploying .NET applications.
Self-contained deployments may require a specific patch version. You can override the minimum runtime patch version (to higher or lower versions) in the project file, as shown in the following example:
The RuntimeFrameworkVersion element overrides the default version policy. For self-contained deployments, the RuntimeFrameworkVersion specifies the exact runtime framework version. For framework-dependent applications, the RuntimeFrameworkVersion specifies the minimum required runtime framework version.
NET 6, which is the most recent LTS version. While support for . NET Core 3.1 ends in December 2022, support for . NET 6 will continue until November 2024.
NET Core 3.1 has succeeded. For new projects, it's recommended to go with the newest and fastest version, .NET 6, since it is the most flexible and performance-oriented version released so far and will work on every scenario and requirement.
NET Standard 2.0 gives you the most reach while supporting .NET 5 ensures that you can leverage the latest platform features for customers that are already on .NET 5. In a couple of years, the choice for reusable libraries will only involve the version number of netX.
NET 6, though, is ASP.NET Core 6, a major upgrade of Microsoft's open source framework for building modern web applications. ASP.NET Core 6 is built on top of the . NET Core runtime and allows you to build and run applications on Windows, Linux, and macOS. ASP.NET Core 6 combines the features of Web API and MVC.
Net doesn't change the .Net Core architecture, but adds some additional benefits including Core Runtime & API Performance enhancement, and deployment flexibility. . Net 5 also supports some major sub-framework for desktop development like Entity Framework, GDI+, LINQ, and ADO.Net.
The version of . NET Framework (4.5 and later) installed on a machine is listed in the registry at HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full. If the Full subkey is missing, then . NET Framework 4.5 or above isn't installed.
NET 6 is a replacement for the legacy .NET Framework. Microsoft has no plans to port Web Forms, Windows Communication Foundation (WCF), or Windows Workflow Foundation (WF) from .
NET 6 can run on natively Mac and Linux, .NET Framework cannot and you would need a third-party runtime like Mono for that capability. . NET 6 you can compile the framework into your application so the separate framework does not need to be installed to run your app. .
NET 6.0 has more advantages than working with the .NET 5.0 as . NET 6.0 has more improvement on the performance which also includes some major advantage as it has intelligent code editing and also it is called the fastest full-stack web framework.
NET 5 and . NET 6 are supported on multiple operating systems, including Windows, Linux, Android, iOS /tvOS, and macOS. The only difference is that .NET 6 is further supported on Windows Arms64 and macOS Apple Silicon while .
We recommend you target .NET Standard 2.0, unless you need to support an earlier version. Most general-purpose libraries should not need APIs outside of .
NET Core is written from scratch to make it a modular, lightweight, fast, and cross-platform Framework Whereas, Microsoft's Net Framework is a software development platform for building and running Windows applications.Net framework includes developer tools, programming languages, and libraries that are used to develop ...
The long-term-support (LTS) version 3.1 of Microsoft .NET Core Framework is slated to go out of support on December 13th, 2022. Microsoft recommends upgrading . NET Core 3.1 applications to .
NET 5 - . NET | Microsoft Learn. This browser is no longer supported. Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
NET Framework is a Microsoft product, which is maintained on Servers available in Microsoft. .NET 5 doesn't support traditional Web Forms, and Windows Workflow Foundation (WWF). .
NET Framework 4.8 is the latest version of . NET Framework and will continue to be distributed with future releases of Windows. As long as it is installed on a supported version of Windows, .NET Framework 4.8 will continue to also be supported.
You can also press the Windows key + R shortcut, then enter "cmd" in the Run dialog box. Then, press CTRL + SHIFT + ENTER to open the Command Prompt. Run The Initial Check . Net Version Command: Type in reg query "HKLM\SOFTWARE\Microsoft\Net Framework Setup\NDP" /s to run the initial check.
.NET Core 3.1 will reach end of support on December 13, 2022. After that date, Microsoft will no longer provide servicing updates or technical support for . NET Core 3.1.
If you're using the latest version of Visual Studio 2019, C#, you may not see the option to change the C# language version of your project. This is a new change in Visual Studio 2019/. NET Core 3.0. The new C# compiler chooses the default version based on your .
Click on the Properties tab.From properties window select Build option.In that click on the Advance button.There you will find out the language version.
NET Standard 2.1, Microsoft has announced tightly coupled C# and . NET version releases. So, C# 9 will be the default and latest language version for .NET 5.
The compatibility of .NET Framework technologies has stayed consistent between .NET 5 and .NET 6 (although WinForms has a few more breaking changes in .
NET 6 towards the end of 2021 gives you a target to aim for, with more features and increased cross-platform support. Code built for .NET 5 will run on .NET 6, and you can update it to take advantage of the new release's additional options and APIs.
The gist is: . NET 6 with PGO enabled may bring you: +30–40% speed on tight loops & cache-friendly logic. +15% for an average code that doesn't depend on networking & IO.
In addition to improvements in costs, performance, and scalability, upgrading to . NET 5 supports the latest C# version and allows our client to utilize the latest Entity Framework (EF) Core 3 package. EF Core 3's benefits include: Faster reading and writing of data from and to the database.
If you're using the latest version of Visual Studio 2019, C#, you may not see the option to change the C# language version of your project. This is a new change in Visual Studio 2019/. NET Core 3.0. The new C# compiler chooses the default version based on your .
Yes, C# 8 can be used with the .NET Framework and other targets older than . NET Core 3.0/. NET Standard 2.1 in Visual Studio 2019 (or older versions of Visual Studio if you install a NuGet package).
NET Framework 4.8 will not. This means that the types required to use these features won't be available on . NET Framework 4.8." "For this reason, using C# 8.0 is only supported on platforms that implement .
NET 5. In Visual Studio, simply right click on your project in Solution Explorer and choose Properties.Under Application > General > Target framework, choose .NET 6.0.
NET Standard 2.0 gives you the most reach while supporting .NET 5 ensures that you can leverage the latest platform features for customers that are already on .NET 5. In a couple of years, the choice for reusable libraries will only involve the version number of netX.
NET Framework 4.6. 1 as supporting . NET Standard 1.5 through 2.0, there are several issues with consuming . NET Standard libraries that were built for those versions from . ... Select . NET Standard version.
NET Framework 4.8 will remain on . NET Standard 2.0 rather than implement . NET Standard 2.1. . NET Core 3.0 as well as upcoming versions of Xamarin, Mono, and Unity will be updated to implement .
Address: Suite 769 2454 Marsha Coves, Debbieton, MS 95002
Phone: +813077629322
Job: Real-Estate Executive
Hobby: Archery, Metal detecting, Kitesurfing, Genealogy, Kitesurfing, Calligraphy, Roller skating
Introduction: My name is Gov. Deandrea McKenzie, I am a spotless, clean, glamorous, sparkling, adventurous, nice, brainy person who loves writing and wants to share my knowledge and understanding with you.
We notice you're using an ad blocker
Without advertising income, we can't keep making this site awesome for you.