Using C# 9 outside .NET 5 #47701
-
Hi, How is C# 9 tied to .NET 5? Will it be possible to use C# 9 outside .NET 5 if using |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 5 replies
-
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:
So I wouldn't recommend using it to accomplish this since you'd now be in a double-unsupported scenario. |
Beta Was this translation helpful? Give feedback.
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: