.NET Standard for C# 9.0

access_time 4 months ago visibility338 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 or Twitter.

Want to publish your article on Kontext?

Learn more

More from Kontext

visibility 18
thumb_up 0
access_time 3 months ago

.NET 5.0 is officially released on 2020-11-10. Refer to this blog page for more details: Announcing .NET 5.0   Download Visual Studio 2019 version 16.8.0 with .NET 5.0 SDK integrated. Release notes Download Visual Studio  .NET SDK version can be changed: { "sdk": { ...

Run .NET 5 on Azure App Services
visibility 145
thumb_up 0
access_time 3 months ago

.NET 5 RC2 was released on 2020-10-13. On Azure, you can only select .NET Core 3.1 or 2.1 LTS versions as runtime stack when creating web app as the following screenshot shows.   This will stay as is till .NET 5 official release. However, you can use extensions to run your .NET 5 ...

visibility 4
thumb_up 0
access_time 2 days ago

This page summarize information about how to retrieve client and server IP address in ASP.NET Core 5 (.NET 5) web applications. This page is an updated version of  Get IP Address in ASP.NET Core 3.x . Client IP address can be retrieved via HttpContext.Connection object. This properties ...