无法加载文件或程序集“System.Data.Entity的 [英] Could not load file or assembly 'System.Data.Entity

查看:163
本文介绍了无法加载文件或程序集“System.Data.Entity的的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是一个解决方案中工作(一个笑话网站)。解决方案有2个项目:

I am working within a Solution (a jokes website). The Solution has 2 Projects:


  1. 模型(C#类库)

  2. MVC 3空应用程序

我试图让我的观点列出在数据库中的笑话,但我得到了以下错误:

I am trying to get my view to list the Jokes in the Database, but I get the following error:

无法加载文件或程序集System.Data.Entity的,版本= 4.0.0.0,
  文化=中性公钥= 31bf3856ad364e35'或一个其
  依赖。该系统找不到指定的文件

Could not load file or assembly 'System.Data.Entity, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified

你可以从错误信息看,我已经添加了System.Data.Entity的到MVC 3应用程序的web.config。

As you can see from the Error message, I have already added the System.Data.Entity to the web.config of the MVC 3 application.

不管我做什么,我似乎无法修复错误!我一直在使用的语句为实体类添加到HomeController的和Index.cshtml。

No matter what I do, I seem to be unable to fix the error! I have added using statements for the Entity class, to the HomeController and the Index.cshtml.

推荐答案

要在ASP.NET MVC 3使用外部实体框架模型(嵌入例如DLL),您必须:

To use an external Entity Framework model (embed in a DLL for example) with ASP.NET MVC 3 you must :


  1. 添加以下引用到你的MVC项目: System.Data.Entity的(版本4.0.0.0,运行v4.0.30319)

  2. 添加下面一行在你的web.config

...

< compilation debug="true" targetFramework="4.0">

  <assemblies>
    <add assembly="System.Data.Entity, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
  </assemblies>
</compilation>

这篇关于无法加载文件或程序集“System.Data.Entity的的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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