access_time 10 months ago languageEnglish
more_vert

.NET Standard for C# 9.0

visibility 1,695 comment 0

In many solutions, .NET standard has been used to share code between .NET Framework and .NET Core projects. Since the release of .NET 5, you probably will think what is the .NET standard version for C# 9 language features.

Well, the answer is simple - there is no need to have another version of .NET Standard such as .NET Standard 3 or .NET Standard 5. The reason is that .NET 5 and its future versions are the unified .NET which can run all the supported platforms.

Current .NET Standard Project

The following project utilizes .NET Standard 2.1.

<Project Sdk="Microsoft.NET.Sdk">
	<PropertyGroup>
		<TargetFramework>netstandard2.1</TargetFramework>
	</PropertyGroup>
</Project>

Change to .NET 5

To utilize the new language features in C# 9.0, just simply change the target framework to .NET 5:

<Project Sdk="Microsoft.NET.Sdk">
  <PropertyGroup>
    <TargetFramework>net5.0</TargetFramework>
  </PropertyGroup>
</Project>

References

copyright This page is subject to Site terms.
Like this article?
Share on

Please log in or register to comment.

account_circle Log in person_add Register

Log in with external accounts

Follow Kontext

Get our latest updates on LinkedIn.

Want to contribute on Kontext to help others?

Learn more