简体   繁体   English

无法加载文件或程序集错误

[英]Could not load file or assembly error

Can anyone help me figure out what the problem is. 任何人都可以帮我弄清问题是什么。 I am trying to start up a C# winformsa app in visual studio and i keep getting this error: 我试图在visual studio中启动一个C#winformsa应用程序,我不断收到此错误:

Could not load file or assembly, Foo.dll version1.93343 or one of its dependencies The system can't find the file specified 无法加载文件或程序集,Foo.dll版本1.93343或其依赖项之一系统找不到指定的文件

vs 2005, C# 2.0 vs 2005,C#2.0

any help 任何帮助

Typically it's about one of your references' reference, possibly deep down in the dependency tree. 通常它是关于您的一个引用的引用,可能在依赖树的深层。 What I usually do is, fire up Sysinternals Process Monitor ( http://technet.microsoft.com/en-us/sysinternals/bb896645.aspx ), filter by process name, and run the app. 我通常做的是,启动Sysinternals Process Monitor( http://technet.microsoft.com/en-us/sysinternals/bb896645.aspx ),按进程名称过滤,然后运行应用程序。 It's typically fairly easy at this point to sift through the FILE NOT FOUNDs and locate the offending missing reference. 在这一点上,通常很容易筛选FILE NOT FOUND并找到有问题的缺失参考。

This is the key part: "or one of its dependencies" 这是关键部分:“或其中一个依赖”

I've often found that the assembly dll file that can't be loaded looks fine. 我经常发现无法加载的程序集dll文件看起来很好。 However one of its dependencies (another assembly dll) does not exist or has been moved. 但是其中一个依赖项(另一个程序集dll)不存在或已被移动。

When the CLR loads an assembly it will also check that all of that assemblies dependencies exist. 当CLR加载程序集时,它还将检查是否存在所有程序集依赖项。 In XCopy deployment this normally means you need all the dependency assemblies in the same directory as your application exe. 在XCopy部署中,这通常意味着您需要与应用程序exe在同一目录中的所有依赖项程序集。

Try loading the winforms executable into Reflector and under "yourApp.exe" expand the References node to see what the other referenced types are. 尝试将winforms可执行文件加载到Reflector中,并在“yourApp.exe”下展开References节点以查看其他引用类型。

启动Fuslogvw.ex e并检查无法找到哪个程序集(或引用)。

值得检查您的全局web.config没有对该程序集的引用

You must have a reference to Foo.dll somewhere and it can't be located (duh). 您必须在某个地方引用Foo.dll,并且无法找到它(duh)。 Do you see a reference in the solution window? 您是否在解决方案窗口中看到了引用? You can right click that and select "properties" to look at the path. 您可以右键单击该选项并选择“属性”以查看路径。

Do you see an exclamation mark on a reference in visual studio's solution explorer ? 在visual studio的解决方案资源管理器中,您是否在引用上看到感叹号?

If so, then you need to remove it then add it again. 如果是这样,那么你需要删除它然后再添加它。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM