Cannot use Entity Framework in .NET standard 2 project

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-11 08:53:31

问题


How can I use Entity Framework, or something similar within a .NET Standard project?

It appears as though EF is not supported in .NET Standard 2 which is really annoying!

So I have tried using Microsoft.EntityFrameworkCore.SqlServer and icrosoft.EntityFrameworkCore.SqlServer.Design

Whist I can install these packages, I cannot then add a model

I get the error

---------------------------
Microsoft Visual Studio
---------------------------
The project's target framework does not contain Entity Framework runtime assemblies. Please review the target framework information in the project's property page.
---------------------------
OK   
---------------------------

How can I get around this?

I am seriously thinking to get rid of .NET Standard out of all my projects but that is a bit drastic!

Paul


回答1:


It looks like the actual question is "How can I create models and reverse engineer a database using EF Core like I could with EF 6" ?

The tooling is separate from the NuGet package. Visual Studio 2017 doesn't include modelling or reverse engineer tools for EF Core. Those are available through EF Core Power Tools an open source addon. You can find the code and documentation here



来源:https://stackoverflow.com/questions/48582603/cannot-use-entity-framework-in-net-standard-2-project

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