我有一个解决方案 - 一个项目是带有 .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/