The located assembly's manifest definition with name xxx.dll does not match the assembly reference
This is a very common Assembly.Load failure exception text. In fusion terminology, this is called Ref-Def-Mismatch. This exception is thrown when fusion finds an assembly that does not match what you are looking for. A very common mismatch is version number. An example is, you asks for version 1.0.0.0, but version 2.0.0.0 is found. (keep in mind that for simply named assemblies, version number is ignored. So we are really talking about strongly named assemblies here.)
The only time this exception will be thrown is when the mismatched assembly is in your appbase. Fusion will probe GAC first. If the assembly is not found in GAC, fusion will probe your appbase. If fusion finds an assembly that matches the simple name, but has mismatch on other part of the assembly name, this exception will be thrown. Say you call Assembly.Load(”MyAsm,Version=1.0.0.0,Culture=Neutral,PublicKeyToken=0123456789abcdef”, and fusion finds MyAsm.dll in your appbase, but its version is 2.0.0.0, fusion will thrown this exception.
An interesting question is why can't fusion just keep probing. Remember fusion will probe a couple of places before it stops. If the first one is mis-matched, maybe later fusion can find another match?
There are several reasons.
1. It is very rare that people will have several assemblies with the same file name in the probing path. So keep probing usually won't help anyone.
2. Because of 1, you get unnecessary penalty if fusion keeps probing. This is especially bad for http bind.
3. Most of the time this exception is due to deployment error. So throwing early will help catch deployment error.
There are more reasons. But I'll show them later when I get time to show some binding design decision.
Another interesting observation on this is for dependencies of LoadFrom assemblies. For dependencies of LoadFrom assemblies, we will probe the appbase, then the parent assembly's directory. If a mismatch assembly is found in appbase, it does not mean a matching assembly won't be found in parent assembly's directory.
In v1/v1.1, we treat this case the same as normal probing, and throw on the first mismatch. In Whidbey, we take a DCR to keep probing the parent assembly's directory. (DCR stands for Design Change Request. It usually means change of behavior)
Comments
Anonymous
March 25, 2004
I've only encountered this problem in Visual Studio but then again I don't do a lot of Windows Forms progrmming. Mine was due to a pluging not uninstalling properly and leaving behind a lot of things in the Private Assembly folder which caused this error when I tried to run Reporting Services.
http://www.lazycoder.com/weblog/index.php?p=45Anonymous
May 07, 2004
The comment has been removedAnonymous
May 09, 2004
http://blogs.msdn.com/suzcook/archive/2003/05/29/57120.aspx is about how to debug assembly loading failures.
For ASP.Net applications, you need to follow instructions on http://blogs.msdn.com/junfeng/archive/2004/02/14/72912.aspx to see assembly binding logs.Anonymous
June 23, 2004
The comment has been removedAnonymous
July 13, 2004
The comment has been removedAnonymous
July 31, 2004
.NET SUCKZZZZZZAnonymous
April 04, 2005
An Assembly Identity is simply an attributes bag. It consists of a set of attributes. Each attribute...Anonymous
November 25, 2005
thanks for your article, I know the problem reason. but how to fix it?
my status is
Server installed: CrystalDecisions.Web, Version=9.1.5000.0
Post-policy reference: CrystalDecisions.Web, Version=9.2.3300.0
How to change "Post-policy reference"?
does it in "machine.config" or "aspnet.config" ??
thanks so much, this problem hit me for 2 days.Anonymous
February 27, 2008
BinaryFormatter The located assembly's manifest definition does not match the assembly referenceAnonymous
February 27, 2008
BinaryFormatter The located assembly's manifest definition does not match the assembly referenceAnonymous
January 21, 2009
PingBack from http://www.keyongtech.com/428532-redirecting-assembly-bindingAnonymous
May 31, 2009
PingBack from http://woodtvstand.info/story.php?id=10356