我正在解决方案(一个笑话网站)中工作。该解决方案有 2 个项目:
我试图让我的 View 列出数据库中的笑话,但出现以下错误:
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 中。
无论我做什么,我似乎都无法修复错误!我已将实体类的 using 语句添加到 HomeController 和 Index.cshtml。
最佳答案
要将外部 Entity Framework 模型(例如嵌入到 DLL 中)与 ASP.NET MVC 3 一起使用,您必须:
...
< compilation debug="true" targetFramework="4.0">
<assemblies>
<add assembly="System.Data.Entity, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
</assemblies>
</compilation>
关于asp.net-mvc-3 - 无法加载文件或程序集“System.Data.Entity”,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5021248/