The located assembly’s manifest definition with name ‘xxxxxx’ does not match the assembly reference

This was an interesting problem I ran across today. There are a lot of articles on the net regarding this happening in asp .net, however I was working on class libraries and none of the articles fit this specific situation.

This problem appears when you’ve produced a new version of a referenced assembly, but for some reason your application is still trying to use an older version.  Its likely it would only occur with strongly named assemblies too, as version numbers aren’t checked for non-strongly-named assemblies.

The reason this is such a strange problem when working with class libraries is that visual studio, by default, updates all of your references when they are updated for you.  So if you recompile an assembly (A) that is referenced by assembly (B), then the next time you compile (B) it will update itself to use the new version of (A).  In theory then, this situation should never happen.

Except that things got a little bit more complicated.  I had an assembly (A).  This assembly referenced a type-assembly (B), and another assembly (C).  I had recompiled both C and B and was in the process of recompiling (A).  Each of these libraries had unit tests using NUnit and though they had all passed for C and B, A’s tests gave the error I mentioned above.  The assembly it was talking about was assembly B.

When I recompiled B however, it should have updated the references in A for me.  I also manually stripped out all of A’s references and re-added them, with no success.

The solution to this problem was hard to spot at first because it actually didn’t have anything to do with Assembly A, thats just where the symptoms showed up.  Turned out, Assembly C also referenced Assembly B, and I had recompiled C first.  This means that C was trying to reference the old version of B, whilst A tried to reference the new version.  All that had to be done was a recompilation of C.and the problem is solved.

I guess the moral of this story is keep track of your reference tree and if you’re doing a full library-wide recompile, compile from the bottom up. 

Advertisements

6 thoughts on “The located assembly’s manifest definition with name ‘xxxxxx’ does not match the assembly reference

  1. диета при одной почке для похуданиядиета бернер-баннерапохудение афродитадиета на овощных и белковых днях отзывы худеющиходзывы о японской диете 3 и 4 деньможно ли есть бананы на диетеизбавление от лишнего веса в набережных челнахэффективные способы похудения диеты спортна чём ездиет губернатор владивостока в москвер конли диета для бедерпохудение при гипотиреозесамая быстрая диета чтобы похудетьморальный настрой в похуденииротвеллер правила питаниядиета при миокардиодистрофиив эмиратах средства для похудениячблочный уксус-диетапохудеть в омске за минимальный срокпростай способ похудетьпохудеть за одну ночь

  2. We’re a bunch of volunteers and opening a new scheme in our community. Your site offered us with useful information to paintings on. You have performed an impressive job and our entire neighborhood will likely be grateful to you.

  3. You actually make it appear really easy with your presentation but I to find this matter to be really something which I think I would never understand. It kind of feels too complicated and extremely huge for me. I’m taking a look ahead on your subsequent publish, I will attempt to get the hang of it!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s