Skip to content

Using C# 9 outside .NET 5 #47701

Answered by PathogenDavid
johnkors asked this question in General
Sep 15, 2020 · 1 comments · 5 replies
Discussion options

You must be logged in to vote

As with C#8 and .NET Core 3.0, C# 9 is only officially supported in combination with a .NET 5 SDK and a .NET 5 runtime. (Edit: Here's a newer source from documentation: C# language versioning: "C# 9.0 is supported only on .NET 5 and newer versions.")

If you're going to go the unsupported route, you're best off using the .NET 5 SDK and targeting an older framework (IE: <TargetFramework>netcoreapp3.1</TargetFramework> ) and explicitly setting your language version with <LangVersion>9</LangVersion>.

Microsoft.Net.Compilers.Toolset is explicitly not intended to support using newer compilers with older toolchains:

Using it as a long term solution for providing newer compilers on older MSBuild…

Replies: 1 comment 5 replies

Comment options

You must be logged in to vote
5 replies
@johnkors
Comment options

@johnkors
Comment options

@PathogenDavid
Comment options

@PathogenDavid
Comment options

@jrmoreno1
Comment options

Answer selected by johnkors
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
3 participants