About Contact me Presentations rss feed  rss

When "Could not load file or assembly" happens

13 Jul 2010

So I was getting an “ Could not Load File or Assembly” error, even thou I was pretty certain I was referencing the right dlls in the correct folders. What could this error possibly mean?

The actual error I had was:

System.IO.FileLoadException: Could not load file or assembly ‘Moq, Version=2.6.1014.1, Culture=neutral, PublicKeyToken=69f491c39445e920’ or one of its dependencies.

Some things I checked:

[caption id=”attachment_616” align=”aligncenter” width=”242” caption=”Reflector Screenshot”][/caption]

This means that moq.contrib.dll did indeed depend on moq, so I just needed to find a version of it that pointed to the right assembly, I was lucky because I had a set of dlls that work, if you are not so lucky, get latest from the moq.contrib google code and simply run the Build.cmd and you are all set to go (you can replace the moq.dll dependecy if they have moved on).

On the way I found some other interesting things


Also known as the Assembly Binder Log Viewer, awesome right? :D

Where is it?  I searched online and the tool seems to move a lot in differnt versions of Windows, In xp

it could be here: C:\Program Files\Microsoft SDKs\Windows\v6.0A\bin\fuslogvw.exe

In my windows 7 install I found it here: ** C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\bin>FUSLOGVW.exe**

Oh yeah and you need to run it from the command line as an Administrator

It might seem obvious, but you need to refresh after you run something that fails , it is, after all a log viewer

If you want to discuss this post, the best place right now for me is mastodon, please message me with your comment/question.