无法在.NET标准2项目中使用Entity Framework

时间:2018-02-02 12:22:29

标签: c# entity-framework entity-framework-6 .net-standard-2.0

如何在.NET Standard项目中使用Entity Framework或类似的东西?

似乎在.NET Standard 2中不支持EF,这真的很烦人!

所以我尝试使用Microsoft.EntityFrameworkCore.SqlServer和icrosoft.EntityFrameworkCore.SqlServer.Design

惠斯特我可以安装这些软件包,我不能再添加模型

我收到错误

---------------------------
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   
---------------------------

我怎样才能解决这个问题?

我正在认真考虑从我的所有项目中删除.NET Standard,但这有点激烈!

1 个答案:

答案 0 :(得分:4)

看起来实际问题是"我如何使用EF Core创建模型并对数据库进行逆向工程,就像我使用EF 6" ?

工具与NuGet包分开。 Visual Studio 2017不包含EF Core的建模或逆向工程工具。这些可以通过EF Core Power Tools开源插件获得。您可以找到代码和文档here