.netfileloadexception

The located assembly's manifest definition does not match the assembly reference


I get the following error:

System.IO.FileLoadException: The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)

It do not give me any hint of which file it's complaining about. How can I find the assembly that it complains about?

(Yes, there are other questions about the same exception here at SO, but they do not answer my question)


Solution

  • Most likely cause is the application is loading a different version of the assembly from somewhere you are not expecting.

    There are a few ways to find out where assembly is loaded from. Best one is to use Sysinternal's ProcessMonitor to see which file it is loading before the error happens.