简体   繁体   中英

How to add reference in ASP.NET Core project

My first ASP.NET Core project.

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

Used NuGet to add reference to 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. I've compared the csproj files and nothing stands out as obvious why one has a references node and the other doesn't.

添加参考?

In .net the Namespace for EntityFramework is System.Data.Entity, but that changed for EF Core: The right namespace is now Microsoft.EntityFrameworkCore so

using Microsoft.EntityFrameworkCore;

should fix it.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM