Programming
c# reference compiler-errors dependencies version
Updated Thu, 04 Aug 2022 02:07:49 GMT

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


I am trying to run some unit tests in a C# Windows Forms application (Visual Studio 2005), and I get the following error:

System.IO.FileLoadException: Could not load file or assembly 'Utility, Version=1.2.0.200, Culture=neutral, PublicKeyToken=764d581291d764f7' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)**

at x.Foo.FooGO()

at x.Foo.Foo2(String groupName_) in Foo.cs:line 123

at x.Foo.UnitTests.FooTests.TestFoo() in FooTests.cs:line 98**

System.IO.FileLoadException: Could not load file or assembly 'Utility, Version=1.2.0.203, Culture=neutral, PublicKeyToken=764d581291d764f7' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)

I look in my references, and I only have a reference to Utility version 1.2.0.203 (the other one is old).

Any suggestions on how I figure out what is trying to reference this old version of this DLL file?

Besides, I don't think I even have this old assembly on my hard drive. Is there any tool to search for this old versioned assembly?




Solution

The .NET Assembly loader:

  • is unable to find 1.2.0.203
  • but did find a 1.2.0.200

This assembly does not match what was requested and therefore you get this error.

In simple words, it can't find the assembly that was referenced. Make sure it can find the right assembly by putting it in the GAC or in the application path. Also see https://docs.microsoft.com/archive/blogs/junfeng/the-located-assemblys-manifest-definition-with-name-xxx-dll-does-not-match-the-assembly-reference.





Comments (5)

  • +0 – but when i look at references of the project, it is pointing to 1.2.0.203 .. . nothing seems to be pointing to 1.2.0.200 anymore — Oct 18, 2008 at 13:40  
  • +0 – Exactly - it's looking for 1.2.0.203, but it found 1.2.0.200. Find out where that file is and replace it with the right version. — Oct 18, 2008 at 13:44  
  • +0 – I asked a similar question here and got a working solution: stackoverflow.com/questions/4187907/… — Nov 15, 2010 at 20:12  
  • +0 – Check the references version, and then look if its the same in packages.config and Web.config — Oct 31, 2014 at 19:46  
  • +0 – This message confuses me every time. It seems to be written backwards. I'd expect it to complain about the version you've asked to load, not the version it found. Glad I'm not the only one who gets it wrong! — Nov 02, 2018 at 16:34