EF 6 with a dnx project

前端 未结 3 1801
[愿得一人]
[愿得一人] 2021-01-17 20:56

I have a new ASP.net 5 dnx class library I am using for entity framework. I need to target EF 6 because some features I need are not in EF 7.

First the EF tools (li

相关标签:
3条回答
  • 2021-01-17 21:24

    I had the same issue. Just setting the start project from ASP.NET Core to my .NET Framework Lib does the trick for me =) Now i can do EF6 migrations as usual "Add-Migration" command...

    P.S. Sorry for my eng.

    0 讨论(0)
  • 2021-01-17 21:42

    Following this recommendation, EF6 data projects should use the existing .NET Framework class library csproj type.

    Even after following the recommendations, I was still getting the same error. Unloading your ASP.NET Core project(s) and then invoking the Enable-Migrations command on the appropriate csproj should allow the command to execute. You can unload a project by right-clicking on the .NET Core project and choosing the 'Unload Project' option. It should also be noted that the Package Manager Console window has a 'Default project:' drop-down selection. You should choose the project with your DbContext.

    0 讨论(0)
  • 2021-01-17 21:45

    It's because ASP.NET Core introduced a new project type/configuration system (see package.config vs project.json) and the old EF tools don't know how to work with the newer system (project.json). It would probably be easiest to create a new project and port your code into it if you want to go back to EF6.

    Interestingly (well, disappointingly actually) they're backtracking on project.json see: http://xoofx.com/blog/2016/05/11/goodbye-project-json/

    0 讨论(0)
提交回复
热议问题