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 (17)

  1. Scott says:

    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=45

  2. Ali Asghar Ahmed says:

    hi,

    I have not specified any version name or strong name.

    so it is giving the error in :

    <add assembly="*"/>

    line, in

    c:winntmicrosoft.netframeworkv1.1.4322Configmachine.config file.

    So what do i do.

  3. 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.

  4. Lars Weber says:

    Hi! 🙂

    Thank you for your very informative weblog.

    Have you heared of the occurence of this message

    "The located assembly’s manifest definition with name xxx.dll does not match the assembly reference" when you register an assembly with regasm?

    It’s kind of strange, because I can reproduce this error on a System that has never had a registration of the specific assembly before.

    The Gac also holds no refference.

    Greetings from Germany,

    Lars (particle@plastic-reality.com)

  5. Disgusted says:

    This is why .NET sucks. The friggin object either works or it doesn’t…regardless of the version. Ridiculous.

  6. SUCKER says:

    .NET SUCKZZZZZZ

  7. An Assembly Identity is simply an attributes bag. It consists of a set of attributes. Each attribute…

  8. Jun Zhang says:

    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.

  9. BinaryFormatter The located assembly&#39;s manifest definition does not match the assembly reference

  10. BinaryFormatter The located assembly&#39;s manifest definition does not match the assembly reference