简体   繁体   English

在运行时找不到VS2012 dll文件

[英]VS2012 dll file not found at run time

I have a project that references a dll file. 我有一个引用dll文件的项目。 I simply added a reference by right clicking on the properties, selected add reference, and browsed for the dll. 我只是通过右键单击属性添加引用,选择添加引用,并浏览dll。 Intellisense recognizes the library and all it's classes/methods but when I run it I get this. Intellisense可以识别库及其所有类/方法,但是当我运行它时,我得到了。

An unhandled exception of type 'System.IO.FileNotFoundException' occurred in program.exe 在program.exe中发生了'System.IO.FileNotFoundException'类型的未处理异常

Additional information: Could not load file or assembly 'Api.dll' or one of its dependencies. 附加信息:无法加载文件或程序集“ Api.dll”或其依赖项之一。 The specified module could not be found. 指定的模块无法找到。

The file appears in the bin folder and is still at the location I browsed too. 该文件显示在bin文件夹中,并且仍然位于我浏览过的位置。 The program runs without errors if I don't use any classes or methods. 如果我不使用任何类或方法,该程序将无错误运行。 The library doesn't have any dependencies I'm aware of. 该库没有我知道的任何依赖项。

Edit: found a lot of missing dependent DLL files using dependency walker that I thought were causing the problem. 编辑:发现很多丢失的依赖DLL文件使用依赖跟踪器,我认为是造成问题的原因。 After putting all the dependent DLL's in the same folder and referencing it the problem persists 将所有从属DLL放在同一文件夹中并对其进行引用后,问题仍然存在

Run Fusion Log Viewer when you run your app. 在运行应用程序时运行Fusion Log Viewer It will tell you exactly what assembly isn't loading. 它会告诉您确切的程序集没有加载。

If nothing shows up in Fusion Log Viewer when you run it, try these settings: 如果运行Fusion Fusion View Viewer时未显示任何内容,请尝试以下设置:

在此处输入图片说明

在此处输入图片说明

I never did understand why results wouldn't show up unless I used the settings this way. 我从来不明白为什么除非以这种方式使用设置,否则结果不会显示。 I would delete all entries, run the app, then hit the Refresh button. 我将删除所有条目,运行应用程序,然后单击“刷新”按钮。

Turns out that even once I found the missing DLL's using dependency walker that they weren't being imported into my project with the original DLL. 事实证明,即使使用依赖行者发现丢失的DLL,也不会将它们与原始DLL一起导入到我的项目中。 Moving them into the bin/debug folder fixed the error 将它们移到bin / debug文件夹中可修复错误

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

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