I've created a new Blazor WebAssembly project in Visual Studio which, by default, targets .NET Standard 2.1 and therefore uses C# 8.
I've also written a library written for .NET 5 and used C# 9 in it.
How can I use this library in my Blazor project? I can't reference a .NET 5 library in a .NET Standard 2.1 project.
- When I change the target framework of the library to .NET Standard 2.1 I cannot use C# 9 anymore in the library project. When I explicitly set the LangVersion in the csproj to 9.0 all of my record types get compile errors that some predefined type System.Runtime.CompilerServices.IsExternalInit is not defined
- When I change the target framework of the Blazor project to .NET 5 and reference a .NET 5 library it doesn't work anymore (start up fails with HTTP Error 500.33 - ANCM Request Handler Load Failure)