VS2012 dll file not found at run time

1.9k views Asked by At

I have a project that references a dll file. I simply added a reference by right clicking on the properties, selected add reference, and browsed for the dll. Intellisense recognizes the library and all it's classes/methods but when I run it I get this.

An unhandled exception of type 'System.IO.FileNotFoundException' occurred in program.exe

Additional information: Could not load file or assembly 'Api.dll' or one of its dependencies. The specified module could not be found.

The file appears in the bin folder and is still at the location I browsed too. 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. After putting all the dependent DLL's in the same folder and referencing it the problem persists

2

There are 2 answers

0
Cameron Scully On BEST ANSWER

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. Moving them into the bin/debug folder fixed the error

3
Bob Horn On

Run Fusion Log Viewer when you run your app. 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:

enter image description here

enter image description here

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.