.net - 类型 'System.Data.Entity.DbContext' 在未引用的程序集中定义。您必须添加对程序集“EntityFramework 2”的引用

标签 .net entity-framework

我有一个解决方案 - 一个项目是带有 .edmx 数据模型的类库 另一个是asp.net web 表单项目。

当我启动解决方案时,出现以下异常:

The type 'System.Data.Entity.DbContext' is defined in an assembly that is not referenced. You must add a reference to assembly 'EntityFramework, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.

当我在我的 asp.net 项目中看到引用时,我看到了对我的类的引用,但看不到对 Entity Framework 的引用。但问题是 Entity Framework 同时安装在我的类库和Web项目中

最佳答案

我认为您的EntityFramework版本很困惑

请使用 NuGet 软件包安装程序下载正确的版本。

请参阅此讨论以开始使用:The type or namespace name 'DbContext' could not be found

看看同样的问题,答案是:Here

关于.net - 类型 'System.Data.Entity.DbContext' 在未引用的程序集中定义。您必须添加对程序集“EntityFramework 2”的引用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19064449/

相关文章:

c# - 检查 WPF DataGrid 中的可见行

c# - 扩展 Membership.CreateUser 方法的参数

c# - 使用 .NET OpenSSL 包装器签署文件

c# - EntityType '' IdentityUserRole' 没有键定义错误

entity-framework - 尚未为此 DbContext 配置数据库提供程序

javascript - 是否有像 Breeze 这样的 java 脚本库允许查询 IQueryable 方法而不是属性?

.net - 如何为方法实现前置条件?

.net - ASP.NET MasterPage + Javascript 错误

entity-framework - EF 5.0 简单映射的多重性错误

c# - 在数据访问项目中使用 web.config 连接字符串