类型“System.Data.Entity.DbContext”在未被引用的程序集中定义。您必须添加一个引用程序集“的EntityFramework 2 [英] The type 'System.Data.Entity.DbContext' is defined in an assembly that is not referenced. You must add a reference to assembly 'EntityFramework 2
问题描述
我有一个解决方案 - 一个项目是类库的.edmx与数据模型 另一种是asp.net web表单的项目。
I've got one solution - the one project is class library with .edmx data model The other is asp.net web forms project.
当我开始解我得到以下异常:
when i start the solution I get the following exception:
类型System.Data.Entity.DbContext'中未被引用的组件被定义。您必须添加一个引用程序集的EntityFramework,版本= 5.0.0.0,文化=中性公钥= b77a5c561934e089。
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项目中引用我看到关于我类我看不出参考实体框架。但问题是,实体框架,无论是在我的类库和已安装的Web项目
and when I see the references in my asp.net project I see the reference to my class and I can't see reference to entity framework. But the problem is that entity framework is installed both in my class library and web project
推荐答案
我觉得你的的EntityFramework
版本被搞糊涂了。
I think your EntityFramework
version was confused
请使用的NuGet
软件包安装程序下载正确的版本。
Please download the correct version by using the NuGet
package installer.
请参阅此讨论入门:<一href="http://stackoverflow.com/questions/5741109/the-type-or-namespace-name-dbcontext-could-not-be-found">The类型或命名空间名称的DbContext找不到
再看看这个同样的问题,答:是<一个href="http://forums.asp.net/t/1856121.aspx?%20System%20Data%20Entity%20DbContext%20is%20defined%20in%20an%20assembly%20that%20is%20not%20referenced">Here
And look this same problem and Answer : is Here
这篇关于类型“System.Data.Entity.DbContext”在未被引用的程序集中定义。您必须添加一个引用程序集“的EntityFramework 2的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!