سؤال

We're having some mystery version mismatches on our referenced dll's loaded at runtime.

Errors like:

Could not load file or assembly X or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)

Is there any way to debug the assembly binding.

In other words, how can I know the following details about loaded assemblies:

  • Version
  • Location
  • Who/What caused the loading (my code, another .dll, ...)
  • Well, just about everything else there is to know...
هل كانت مفيدة؟

المحلول

The Assembly Binding Log Viewer (aka Fusion Log Viewer, fuslogvw.exe) shows useful data for these sorts of issues such as:

  • What process is trying to load an assembly
  • The full name of the assembly (version, culture, public key token)
  • The assembly that's causing the load
  • Which paths were probed for the assembly

You can log all binds or just bind failures.

fuslogvw.exe should be accessible directly from any VS command prompt.

نصائح أخرى

Totally agree with Chris, Assembly Binding Log Viewer should give you all information you need. In addition you could also use WinDbg + SOS.dll. Mostly it's used for debugging but can be quite useful in some other cases when you need to know as much information as possible. The only problem that could stop you is that it doesn't have nice UI like VS debugger :)

Good luck!

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top