NU1202 Package Microsoft.EntityFrameworkCore 6.0.3 is not compatible with netstandard2.1

5.9k Views Asked by At

I am trying to install the latest Microsoft.EntityFrameworkCore 6.0.3 into a class library project targetting netstandard2.1 using Nuget Package Manager and I get this error:

Package Microsoft.EntityFrameworkCore 6.0.3 is not compatible with netstandard2.1 (.NETStandard,Version=v2.1). Package Microsoft.EntityFrameworkCore 6.0.3 supports: net6.0 (.NETCoreApp,Version=v6.0)

Can anyone help me with their guidance to fix this issue?

2

There are 2 best solutions below

0
On

After upgrading the classlibrary from .NETStandard 2.1 to net6.0 and then adding the nuget packages related to EntityFramework 6.0.3 worked for me.

1
On

To add to Santosh's Answer.

Back in 2020 MSFT put out a statement that they were moving away from .Net Standard.

Essentially:

  • Use netstandard2.0 to share code between .NET Framework and all other platforms.

  • Use netstandard2.1 to share code between Mono, Xamarin, and .NET Core 3.x.

  • Use net5.0 for code sharing moving forward.

So with the above, transitioning class libraries to .NET 6 makes sense.

More:

https://devblogs.microsoft.com/dotnet/the-future-of-net-standard/