How to run dotnet restore forcing the restore to come from .NETStandard instead of .NETFramework?

1.2k views Asked by At

I had a project which was created in .NETFramework. I have followed the steps on https://learn.microsoft.com/en-us/dotnet/core/porting/ to convert the solution to .NETStandard. In particular all projects in the solution have .NETStandard as the Target Framework There are several packages that are restored using .NETFramework when I clean and build the projects I get errors/warnings like the following:

Warning NU1701 Package 'EntityFramework 6.1.3' was restored using '.NETFramework,Version=v4.6.1, .NETFramework,Version=v4.6.2, .NETFramework,Version=v4.7, .NETFramework,Version=v4.7.1, .NETFramework,Version=v4.7.2, .NETFramework,Version=v4.8' instead of the project target framework '.NETStandard,Version=v2.1'. This package may not be fully compatible with your project.

Is there a way in the Package Manager console to run dotnet restore forcing the restore to come from .NETStandard?

1

There are 1 answers

4
Dai On

Entity Framework 6.1.3 does not support .NET Standard at all, it only supports the .NET Framework; this is because EF 6.1.3 was released in 2015 before .NET Standard was even a thing.

You need to use Entity Framework 6.3.0 or later for compatibility with .NET Standard.

You should use the latest version: Entity Framework 6.4.4.