I am working a new project - and I want to do it using the latest .NET Core.

Reading through the documentation, I came across the comparison between Entity Framework Core and Entity Framework 6.x Comparison. Here

Some of the features that I require like: Spatial Data Type is NOT supported by EF Core. So I CAN'T use it, because Spatial Data Type is required in the Project.

Going through the documentation again, I came across this link on How to use EF 6.x with .NET Core: Here

In the article it mentions (Here):

Before you start, make sure that you compile against full .NET Framework in your project.json as Entity Framework 6 does not support .NET Core. If you need cross platform features you will need to upgrade to Entity Framework Core.

I don't really need my project to be cross platform.

The article is not very clear on how to use EF6 with ASP.NET Core.

I created a new ASP.NET Core Web Application

then I installed EF6 using Nuget Package Manager, and got the following error

enter image description here

I went and removed the netcoreapp1.0 from the frameworks in project.json and added net46 as framework, which removed the error for EF, but now I am getting another error.

enter image description here

  1. So how do I use EF6 with ASP.NET core?

  2. When I use EF6 I have to remove all references to .NET Core, does this mean I am not using .NET Core? What are the disadvantages of this other than it can't run cross platform?

9/9/2016 7:26:01 PM

Popular Answer

To stop the second error you need to remove the following from the dependencies section of your project.json:

"Microsoft.NETCore.App": {
    "version": "1.0.0",
    "type": "platform"

For reference, the documentation for referencing the full .NET Framework and Entity Framework 6 from an ASP.NET Core project has a full project.json example.

Removing references to .NET Core does not mean you are not using ASP.NET Core. You are only changing the target runtime platform that your ASP.NET Core project will execute on.

Using ASP.NET Core with the full .NET Framework, you get the benefits of the new project structure and unified story for building web UI and web APIs (e.g. unified Controller class), and you also gain access to the mature, fully-featured .NET Framework, enable use of dependencies and NuGet packages which haven't been ported to .NET Core, for example Entity Framework 6.

10/24/2016 1:58:06 PM

Related Questions


Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow