Scenario:
I am planning to upgrade a WebApi-based web project from .Net 5 to 6. I have many dotnet standard 2.1 class library projects in my solution. When trying to upgrade from EF Core 5 to 6 it did not allow me to do so. Error says
Package Microsoft.EntityFrameworkCore 6.0.0 is not compatible with netstandard2.1 (.NETStandard,Version=v2.1).
Package Microsoft.EntityFrameworkCore 6.0.0 supports: net6.0 (.NETCoreApp,Version=v6.0)
Questions:
Should I migrate all my class libraries to .NET 6.0?
Is it worth doing it?
Am I losing anything just to get the latest EF Core?
Why dotnet standard 2.1 support is not recommended any more?
There is a great article detailing why .NET team has decided to move from .NET Standard approach - The future of .NET Standard:
To your questions:
If you are going to maintain and/or develop the project further it is totally worth it. .NET 5 is out of support now and will not receive any updates including security ones
You are not only getting the latest EF Core. You are getting a lot of other stuff too - aforementioned security updates, performance improvements, new language features. As for loses - the main one would be ability to use your libraries in .NET 5 projects but it can be solved with multitargeting, but based on the question I doubt that you will actually need it.
Note that .NET Standard is not deprecated and the following frameworks versions should support it (so you can use .NET Standard libraries in them).
Read also: