找不到System.Data.Entity.DbContext作为参考添加 [英] System.Data.Entity.DbContext can't find to add as a reference

查看:88
本文介绍了找不到System.Data.Entity.DbContext作为参考添加的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我去构建项目时,出现以下错误:

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?

推荐答案


  1. 选择引发此错误的项目

  2. 转到菜单视图->其他窗口->程序包管理器控制台

  3. 确保在默认的
    Project下拉菜单中选择了有问题的项目

  4. 然后键入命令 install-package entityframework -version
    5.0.0.0

  1. Select the project which throws this error
  2. Go to the menu View -> Other windows -> Package Manager Console
  3. Make sure your problematic project got selected in the default Project" drop-down in the PMC console.
  4. then type the command "install-package entityframework -version 5.0.0.0"

它应该安装缺少的版本。

It should install the missing version.

这篇关于找不到System.Data.Entity.DbContext作为参考添加的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆