简体   繁体   English

如何在ASP.NET Core项目中添加引用

[英]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.

相关问题 如何在ASP Net Core项目中添加类库项目的引用 - How to add reference of class library project in asp net core project 如何在ASP.NET Core项目中包含对程序集的引用 - How to include reference to assembly in ASP.NET Core project 引用ASP.NET Core中的现有.NET Framework项目 - reference an existing .NET Framework Project in an ASP.NET Core ASP.NET 核心 Web API - 项目参考中的 ConnectionString - ASP.NET Core Web API - ConnectionString in project reference 在 MSTest 项目中添加 Asp.Net Web 站点项目的参考 - Add reference for an Asp.Net Web Site project in an MSTest Project 将Angular 4种子项目主题添加到asp.net核心项目 - Add Angular 4 seed project theme to asp.net core project 我如何引用MVC项目中的类,该类使用asp.net核心从数据库中检索数据 - How can I reference a class in MVC project that retrieves data from database with asp.net core 如何在我的 ASP.NET Core MVC 项目中引用 Microsoft.JQuery.Unobtrusive.Ajax - How to reference Microsoft.JQuery.Unobtrusive.Ajax within my ASP.NET Core MVC project 无法在 asp.net 核心 3.1 中添加对 CSharpCompilation 的 MetadataReference 的引用 - Not able to add reference to MetadataReference of CSharpCompilation in asp.net core 3.1 如何将 LinkGenerator 添加到 ASP.NET Core? - How to add LinkGenerator to ASP.NET Core?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM