-1

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?

ENV
  • 877
  • 2
  • 10
  • 32

1 Answers1

1

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.

Dai
  • 141,631
  • 28
  • 261
  • 374
  • I have updated to Entity Framework 6.4.4 and get the same error/warning message. The same is happening for other packages, so the error may not be unique to just Entity Framework. – ENV Sep 04 '20 at 01:16
  • @ENV Does the same message appear but still referencing `6.1.3` - or does it say `6.4.4.` now? Also, have you tried nuking your solution's `packages` folder? – Dai Sep 04 '20 at 01:30
  • Correct. Now it's the same message but for 6.4.4. What do you mean by nuking the solution's packages folder? – ENV Sep 04 '20 at 02:03
  • By "nuking the solution's packages", I mean you should delete (or rename) your `packages` directory which is in the same directory as the `*.sln` file (not the same thing as your `%HOMEDRIVE%%HOMEPATH%\.nuget\packages` directory, leave that one alone). – Dai Sep 04 '20 at 04:16