实体框架5-无法加载文件或程序集EntityFramework,版本= 5.0.0.0 [英] Entity Framework 5 - Could not load file or assembly EntityFramework, Version=5.0.0.0

查看:281
本文介绍了实体框架5-无法加载文件或程序集EntityFramework,版本= 5.0.0.0的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试将Entity Framework 5用于我的项目,但在安装程序集以使其合规方面似乎出现了一些问题.而且由于我最初是使用nuget安装的,因此我不确定我需要做些什么才能使其按预期工作.请问我需要做些什么来解决此问题?

I am trying to use Entity Framework 5 for my project but I seem to be having some issue getting the assembly installed to comply. And since I installed this initially using nuget, I am not certain what I need to do to cause this to work as I expect . Any help on what I need to do to fix this problem please?

* System.IO.FileNotFoundException:无法加载文件或程序集EntityFramework,Version = 5.0.0.0,Culture = Neutral,PublicKeyToken = b77a5c561934e089'或其依赖项之一系统找不到指定的文件.WRN:程序集绑定日志记录已关闭.要启用程序集绑定失败日志记录,请设置registy值. . . *

通过使用融合日志,我得到了

*** Assembly Binder Log Entry  (7/17/2012 @ 9:29:09 PM) ***

The operation failed.
Bind result: hr = 0x80070002. The system cannot find the file specified.

Assembly manager loaded from:  C:\Windows\Microsoft.NET\Framework\v4.0.30319\clr.dll
Running under executable  C:\PROGRAM FILES (X86)\MICROSOFT VISUAL STUDIO 11.0\COMMON7\IDE\COMMONEXTENSIONS\MICROSOFT\TESTWINDOW\vstest.executionengine.x86.exe
--- A detailed error log follows. 

=== Pre-bind state information ===
LOG: User = WORKALOT\Tokorie
LOG: DisplayName = Budget.Data, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
 (Fully-specified)
LOG: Appbase = file:///C:/Development/Summer2012BudgetApp/Budget.Service.Test/bin/Release
LOG: Initial PrivatePath = NULL
LOG: Dynamic Base = NULL
LOG: Cache Base = NULL
LOG: AppName = vstest.executionengine.x86.exe
Calling assembly : Budget.Lib, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null.
===
LOG: This bind starts in default load context.
LOG: Using application configuration file: C:\PROGRAM FILES (X86)\MICROSOFT VISUAL STUDIO 11.0\COMMON7\IDE\COMMONEXTENSIONS\MICROSOFT\TESTWINDOW\vstest.executionengine.x86.exe.Config
LOG: Using host configuration file: 
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework\v4.0.30319\config\machine.config.
LOG: Policy not being applied to reference at this time (private, custom, partial, or location-based assembly bind).
LOG: Attempting download of new URL file:///C:/Development/Summer2012BudgetApp/Budget.Service.Test/bin/Release/Budget.Data.DLL.
LOG: Attempting download of new URL file:///C:/Development/Summer2012BudgetApp/Budget.Service.Test/bin/Release/Budget.Data/Budget.Data.DLL.
LOG: Attempting download of new URL file:///C:/Development/Summer2012BudgetApp/Budget.Service.Test/bin/Release/Budget.Data.EXE.
LOG: Attempting download of new URL file:///C:/Development/Summer2012BudgetApp/Budget.Service.Test/bin/Release/Budget.Data/Budget.Data.EXE.
LOG: All probing URLs attempted and failed.

推荐答案

按照错误消息的建议运行融合日志工具,以获取有关运行时在哪里寻找dll的更多信息,因此您更好地了解为什么它会失败.

Run the fusion log tool as suggested by the error message to get more information about where the runtime is looking for the dll's so you get a better idea of why it is failing.

Scott Hanselman发表了一篇有关 Fusion-loggning 的好文章,介绍如何启用等等,然后只需在命令提示符下以admin身份运行fuslogw.

There is a good article about Fusion-loggning by Scott Hanselman, how you enable it etc, then just run fuslogw as admin from command prompt.

更新

融合日志向我们显示了运行时在何处查找您的DLL,在本例中为Budget.Data,它在以下位置查找:

The fusion log shows us where the runtime is looking for your DLLs, in this case Budget.Data, which it looks for in:

bin/Release/Budget.Data.DLL 
bin/Release/Budget.Data/Budget.Data.DLL
bin/Release/Budget.Data.EXE
bin/Release/Budget.Data/Budget.Data.EXE

您可以验证DLL实际上在这些目录之一中吗?如果是,请检查DLL上的目标框架(检查项目属性)?目标框架是否与EF 5.0兼容?您其他程序集的目标框架是什么

Can you verify that the DLL is in fact in one of these directories ? If it is check the target framework on your DLL (check the project properties) ? Is the target framework compatible with EF 5.0 ? What is the target framework of your other assemblies (if any)

这篇关于实体框架5-无法加载文件或程序集EntityFramework,版本= 5.0.0.0的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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