EF 6 with a dnx project

这一生的挚爱 提交于 2019-12-01 15:57:18

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.

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/

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.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!