SOLVED: The located assembly’s manifest definition does not match the assembly reference

When working on a project recently I got an error that complained the assembly's manifest definition did not match the assembly reference. Read on to discover my simple fix.

Scenario

When I opened up a project the other day and simply tried to compile it I was struck with the following error:

Could not load file or assembly 'Intelligencia.UrlRewriter, Version=2.0.0.6, Culture=neutral, PublicKeyToken=0573f3650687980d' or one of its dependencies. The located assembly’s manifest definition does not match the assembly reference. HRESULT: 0x80131040

The assembly in question could be any assembly. It is

I have a central repository of 3rd party libraries on my development computer. Normally I keep them all in a central location so that I don't have to waste time downloading them again when I need them in a new project.

This time I learned a quick lesson in keeping newer versions partioned away from older versions. Part of my original theory was that I could just drop the latest version of an assembly into that libraries folder and the next time I compiled the project it would use the refresh file and automatically update it to use the latest version.

Solution

It turns out that this plan didn't work so well for me. The refresh or maybe the web.config had an older version number embedded in it somewhere. So when it tried to refresh it got confused and gave the error above.

The solution was pretty simple. Just delete the assembly and associated files from my projects bin folder and then choose Add Reference to add the latest version back in.

A quick recompile later and I was on my way.

kick it Shout it vote it on WebDevVote.com

14 comments :

Anonymous said...

poh... what a solution!!

Eric said...

I have my web app setup to email me anytime there is an internal error. It also sends me user info, such as browser, machine name and login id (corporate domain). I get regular emails with this error, but only for two users, out of a few hundred. Any ideas what would make this happen for specific users?

Eduardo said...

I tryed so many harder things...
haha, thanks

Blackradio said...

I have the same problem bur when i release a smary client. When i run the exe file, throught iExplorer, it can't delete the old library located in \Local Settings\Application Data\assembly and it makes a mismatch but i can't go to the users machine and manually delete the old assemblies... Someone has a solution for this?

Derek Greer said...

I just ran into this problem myself. For me, it seems just cleaning the project and recompiling did the trick. No need to remove/re-add references.

Unknown said...

I have replace the necessary assemblies into Bin folder, and add and replace the necessary assemblies in references from that Bin folder. Still i am getting same problem

Unknown said...

Para resolver o problema, excluir a bin do meu projeto, e instalei as referência tudo via Nuget

NCTideFan said...

FYI I got this error after changing strong signing keys for a few assemblies..then trying to run in from Studio... I deleted each project's BIN folder and let them get rebuilt, and all was right with the world again. . .

Anonymous said...

Thx!!! Solved my problem!

steve.eschweiler said...

Nice post! - I just searched on bin/ in Windows Explorer and delete all of them. Then I just did a rebuild and it all worked. Thanks for helping!

Anonymous said...

Thanks so much! This post came in handy.

prince said...

Policy file was there in assembly which was redirecting to newer version of dll, i just uninstall from assembly and it start working

Simon said...

I thought that was the job of Clean or Rebuild. Apparently not.

Unknown said...

That worked perfectly to me