“could not load the assembly or one of its dependencies” errors

I don't know for yourself, but I have recently a lot of “could not load the assembly or one of its dependencies” errors in different projects.

Because it's not exactly pinpointing the real source of the problem, I usually rebuild a couple of times to have a good compilation. Weird :-(

Anyway Marc Miller mention this :

There are still some people who don’t know about this tool, so I thought I’d just mention it: fuslogvw, which comes with the sdk, is a great tool for diagnosing those otherwise annoyingly opaque “could not load the assembly or one of its dependencies” errors. 

 

The other day, we were debugging one of these for about an hour when I suddenly remembered this tool: an assembly Foo.dll couldn’t load even though it was certainly in the GAC – we disassembled and checked all of its dependencies and then ran depends to see if it had native dependencies that were missing.  Finally, we ran fuslogvw and the log told us that an entry in machine.config was redirecting the assembly version number to a different version than the application was requesting and was installed in the GAC.

 

Thanks Marc for this, I will give a try.

 

No Comments