[英]How to add reference in ASP.NET Core project
My first ASP.NET Core project. 我的第一个ASP.NET Core项目。
I'm getting an error 我遇到错误
Error CS0234 The type or namespace name 'Entity' does not exist in the namespace 'System.Data' (are you missing an assembly reference?)
错误CS0234类型或名称空间名称'Entity'在名称空间'System.Data'中不存在(您是否缺少程序集引用?)
Used NuGet to add reference to Entity Framework Core. 使用NuGet添加对Entity Framework Core的引用。 I believe that should have fixed it, but no luck.
我相信应该已经解决了,但是没有运气。
As you can see, the lib is listed under the Dependencies
node instead of the usual References
node, if that matters. 如您所见,如果重要,那么lib将在
Dependencies
节点下列出,而不是通常的References
节点下列出。 I've compared the csproj files and nothing stands out as obvious why one has a references node and the other doesn't. 我已经对csproj文件进行了比较,但没有一个明显的原因是为什么一个具有引用节点,而另一个没有引用节点。
In .net the Namespace for EntityFramework is System.Data.Entity, but that changed for EF Core: The right namespace is now Microsoft.EntityFrameworkCore so 在.net中,EntityFramework的命名空间为System.Data.Entity,但对于EF Core进行了更改:正确的命名空间现在为Microsoft.EntityFrameworkCore,因此
using Microsoft.EntityFrameworkCore;
should fix it. 应该修复它。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.