找不到System.Data.Entity.DbContext作为参考添加 [英] System.Data.Entity.DbContext can't find to add as a reference
问题描述
当我去构建项目时,出现以下错误:
When I go to build my project, I get this error:
类型'System.Data.Entity.DbContext'为在未引用的程序集中定义。您必须添加对程序集 EntityFramework,Version = 5.0.0.0,Culture = neutral,PublicKeyToken = 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'.
我正在尝试访问用EF5创建的 DbContext
。
我尝试将 System.Data.Entity.DbContext
添加到我的引用中,但是找不到。我该怎么办?
I am trying to access my DbContext
that I created with EF5.
I tried to add System.Data.Entity.DbContext
to my references, but I couldn't find it. What should I do?
推荐答案
- 选择引发此错误的项目
- 转到菜单视图->其他窗口->程序包管理器控制台
- 确保在默认的
Project下拉菜单中选择了有问题的项目 - 然后键入命令 install-package entityframework -version
5.0.0.0
- Select the project which throws this error
- Go to the menu View -> Other windows -> Package Manager Console
- Make sure your problematic project got selected in the default Project" drop-down in the PMC console.
- then type the command "install-package entityframework -version 5.0.0.0"
它应该安装缺少的版本。
It should install the missing version.
这篇关于找不到System.Data.Entity.DbContext作为参考添加的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!