Last post Dec 20, 2019 08:30 PM by bruce (sqlwork.com)
Dec 15, 2019 02:40 AM|Albertk89|LINK
I would like to know if it is possible to compile a project with Asp.net Core 2.2 with C# 8 in Visual Studio 2017 ? My project csproj below does not compile and I have core 3.1 sdk installed.
Dec 15, 2019 03:07 AM|lextm|LINK
Microsoft made it very clear that .NET Core 3.x requires VS 2019 16.4 and above, https://docs.microsoft.com/en-us/dotnet/core/whats-new/dotnet-core-3-1 VS2017 won't work.
Dec 15, 2019 04:11 AM|bruce (sqlwork.com)|LINK
C# 8 requires .net core 3.1 runtime or later to run the assemblies it produces. C# 7.3 is the most current version that will support core 2.2. With C# 8.0 and beyond, the compiler version will be tied to a minimum runtime version. This allows the compiler
changes to have matching runtime changes.
note: As core 2.2 is only supported for a couple more weeks (ends 12/23/2019), you should fall back to 2.1 (supported to 8/21/2021) or upgrade to 3.1
Dec 15, 2019 10:32 PM|JeremyMorgan|LINK
Are you trying to compile C# 8 to 2.2 assemblies, or are you trying to compile older code to 3.1 assemblies?
Dec 16, 2019 12:30 AM|Albertk89|LINK
No, I am compiling a Web API ASP.net Core 2.2. The main reason that I cannot move to 3.0 or 3.1 is due to Odata still not supporting 3.1
Dec 16, 2019 09:11 AM|Sherry Chen|LINK
Hi Albertk89 ,
I would like to know if it is possible to compile a project with Asp.net Core 2.2 with C# 8 in Visual Studio 2017 ?
No , the latest C# compiler determines a default language version based on your project's target framework or frameworks. C# language version default in .Net Core 3.x is C#8.0 , and in .Net Core 2.x is C# 7.3.
You could refer to the C# language versioning Microsoft doc.
Best Regards ,
Dec 16, 2019 03:18 PM|bruce (sqlwork.com)|LINK
As I stated, C# 8 requires a 3.1 runtime. Also as you can not move to 3.1, you should fall back to 2.1 as 2.2 support ends this month.
Dec 20, 2019 03:05 AM|lextm|LINK
The main reason that I cannot move to 3.0 or 3.1 is due to Odata still not supporting 3.1
That can be an invalid reason. Anything that works for .NET Core 2.x should work for .NET Core 3.x (unless unfortunately blocked by breaking changes). I don't recall .NET Core 3.x has OData related bugs.
Dec 20, 2019 08:30 PM|bruce (sqlwork.com)|LINK
follow this thread for core 3.1 support in odata:
it appears the daily build from 3 days ago may work.