1

All, I recently started working on a project that uses EF Core 1.1.2. I saw where 2.0 was released because I started getting errors when I tried to add EF core to a project. I couldn't update the existing project, I created a brand new console project. Set the .Net framework to 4.6.1 and still had no luck. I always get the following message. Has anyone ran into this issue? thanks in advance

Install-Package : Could not install package 'Microsoft.EntityFrameworkCore.SqlServer 2.0.0'. You are trying to install this package into a project that targets '.NETFramework,Version=v4.6.1', but the package does not contain any assembly references or content files that are compatible with that framework.

joseluisrod
  • 82
  • 1
  • 7
  • 3
    The dependency is on .NetStandard 2.0, not Core. You can see what supports this [here](https://learn.microsoft.com/en-us/dotnet/standard/net-standard). @Liam I think the table in the link should show why previous versions worked. – Scrobi Aug 15 '17 at 13:40
  • 2
    @Scrobi From the link it looks like it should work with 4.6.1 *with 2.0 tooling* whatever that means. These guys are just killing me, what a mess :( – Ivan Stoev Aug 15 '17 at 13:55
  • @Liam, I hear what you are saying, but I have a project targeting Net framework 4.5.2. in this project I have installed EF core 1.1.2 and it works like a charm. I found this link. [link](https://stackoverflow.com/q/40716588/55183) – joseluisrod Aug 15 '17 at 14:09
  • 1
    @Ivan - from reading the comments I don't think the tooling is available yet. I think they are going to amend it to show it as _'preview'_ https://github.com/dotnet/docs/pull/2371 – Scrobi Aug 15 '17 at 14:17
  • @Scrobi I've just checked, the tooling has been released :) – Ivan Stoev Aug 15 '17 at 14:39
  • 1
    @Ivan - well found :) – Scrobi Aug 15 '17 at 14:53

3 Answers3

6

EF Core 2.0 release has been officially announced and the documentation is (partially) updated.

Of course it's not NET Core only. But the actual prerequisites for targeting Full .NET Framework are as follows:

(1) Project targeting .NET Framework 4.6.1 and above.

(2) Visual Studio 2017 with (important!) 15.3.0 update (also just released) installed

Before updating the VS I was getting the same error. After updating the error is gone and EF 2.0 package is successfully installed.

Ivan Stoev
  • 195,425
  • 15
  • 312
  • 343
3

EF Core 1.1.2 had a dependency on .NETStandard 1.3 or .NETFramework 4.5.1. So as you were targeting .NetFramework 4.5.2 everything is hunky dory.

EF Core 2.0 has a dependency on .NETStandard 2.0. This is not compatible with the .NETFramework, everything is far from hunky dory.

According to the source below you can get .NetFramework support with 2.0 tooling, which is in preview:

The alternative would be to migrate your application so it doesn't use the .NetFramework but only targets .NETStandard libraries.

Sources

Good luck.

Community
  • 1
  • 1
Scrobi
  • 1,215
  • 10
  • 13
1

EntityFramework Core 2.0.0 is not compatible with a Target framework other than Core 2.0.0. You will need to ensure your project is targetting this and install any dependancies.

It will NOT work with the (standard) .NET framework versions, it is a 'Core' specific release.

ChrisBint
  • 12,773
  • 6
  • 40
  • 62