1

I'm new to ASP.NET Core, as far as I understand to connect to an SQL Express db (or LocalDB) I need the EntityFramework installed. Trying to add it from the NuGet manager the installation is completed successfully but I get this warning:

The package 'EntityFramework 6.1.3' was restored by '.NETFramework,Verions=v4.6.1' and not by the destination framework of the project '.NETCoreApp,Version=v2.0'. This package might not be completely compatible with the project.

Please be aware this is my translation from the Italian, hence the actual English message may differ a bit.

I don't understand how to "restore" (maybe "install"?) the packages by the target framework.

1
  • Have you checked the version in packages.config? This is the version that NuGet will restore if it doesn't find the package in the solution's packages folder Commented Oct 20, 2017 at 15:25

1 Answer 1

4

The Problem you have is that you are trying to install EF for .Net but you should actually install the EF Core version. Now there are 2 versions of EF one for the .NetFramework called EntityFramework and one for the .NetCore Framework called EntityFrameworkCore. Since both the .Net Framework 4.6.1 and the .NetCore Framework 2.0.0 implement the .Net Standard 2.0 you can actually use the "normal" EF libraries within a .NetCore Project. Which is what you were doing. Since those package were not designed to be used with NetCore NuGet will show the warning you mentioned above. So you most likely want to uninstall EntityFramework and install EntityFrameworkCore. Read here EF Core Docu for instructions

Sign up to request clarification or add additional context in comments.

1 Comment

Maybe you should explicity say "trying to install EF for .Net Framework", its a bit more clear, that EF is not really for .Net Core

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.