14

I am developing a c# application and I get the following error at debug runtime:

An unhandled exception of type 'System.IO.FileNotFoundException' occurred in Unknown Module.

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

Autodesk.Navisworks.Timeliner.dll is in the debug folder of the application. I have repaired the .net framework (version 4) but it did not resolve it. Any ideas on how to resolve this issue? Thanks.

mj1261829
  • 1,200
  • 3
  • 26
  • 53

6 Answers6

13

Enable this option in VS: Just My Code option

Tools -> Options -> Debugging -> General -> Enable Just My Code (Managed only)

Nanu
  • 3,010
  • 10
  • 38
  • 52
8

First check - is the working directory the directory that the application is running in:

  • Right-click on your project and select Properties.
  • Click the Debug tab.
  • Confirm that the Working directory is either empty or equal to the bin\debug directory.

If this isn't the problem, then ask if Autodesk.Navisworks.Timeliner.dll is requiring another DLL which is not there. If Timeliner.dll is not a .NET assembly, you can determine the required imports using the command utility DUMPBIN.

dumpbin /imports Autodesk.Navisworks.Timeliner.dll

If it is a .NET assembly, there are a number of tools that can check dependencies.

Reflector has already been mentioned, and I use JustDecompile from Telerik.


Also see this question
Community
  • 1
  • 1
Andrew Shepherd
  • 44,254
  • 30
  • 139
  • 205
  • I decompiled the dll using Net.reflector, looked at references, and added all the required dependencies. Only a reference to 'msorlib' cannot be added as it is already referenced by the build system. The same error occurred – mj1261829 Mar 16 '12 at 00:23
  • Reflector has some advantages over JustDecompile see edited answer – Micah Armantrout Mar 16 '12 at 02:15
4

If you are running on a 64 bit system and trying to load a 32 bit dll you need to compile your application as 32 bit instead of any cpu. If you are not doing this it behaves exactly as you describe.

If that isn't the case use Dependency Walker to verify that the dll has its required dependencies.

Yaur
  • 7,333
  • 1
  • 25
  • 36
  • I decompiled the dll using Net.reflector, looked at references, and added all the required dependencies. Only a reference to 'msorlib' cannot be added as it is already referenced by the build system. The same error occurred – mj1261829 Mar 16 '12 at 00:17
  • Was running an old project on a new machine. This answer lead me to realize all this was caused by target x64 instead of x86. – JensB May 11 '16 at 16:31
2

Add following codesnippet in your cofig file

<startup useLegacyV2RuntimeActivationPolicy="true">
   <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/>
</startup>
0

For me it was occurring in a .net project and turned out to be something to do with my Visual Studio installation. I downloaded and installed the latest .net core sdk separately and then reinstalled VS and it worked.

Jimmy
  • 2,191
  • 6
  • 25
  • 45
0

What I would do is use this tool and step through where you are getting the exception

http://www.reflector.net/

Read this it will tell you how to create PDB's so you do not have to have all your references setup.

http://www.cplotts.com/2011/01/14/net-reflector-pro-debugging-the-net-framework-source-code/

It is a trial and I am not related to redgate at all I just use there software.

Micah Armantrout
  • 6,781
  • 4
  • 40
  • 66
  • I decompiled the dll using Net.reflector, looked at references, and added all the required dependencies. Only a reference to 'msorlib' cannot be added as it is already referenced by the build system. The same error occurred – mj1261829 Mar 16 '12 at 01:12
  • Updated my answer to give more infoation – Micah Armantrout Mar 16 '12 at 01:41