Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Assembly's manifest definition does not match assembly reference

I updated all the packages of my MVC project and I got the following error:

Could not load file or assembly 'Antlr3.Runtime, Version=3.5.0.2, Culture=neutral, PublicKeyToken=eb42632606e9261f' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)

Building the project with a razor (.cshtml) file open gave me more errors

like image 233
galdin Avatar asked Jan 07 '14 17:01

galdin


People also ask

Where is assembly manifest located?

File Location This is usually the WinSxS folder in the Windows directory. As manifests that accompany private assemblies, assembly manifests should installed in the directory structure of the application. This is usually a separate file in the same folder as the application's executable file.

What is assembly manifest in C#?

An assembly manifest contains all the metadata needed to specify the assembly's version requirements and security identity, and all metadata needed to define the scope of the assembly and resolve references to resources and classes. The assembly manifest can be stored in either a PE file (an .exe or .

Can not load file or assembly?

In summary if you get the "Could not load file or assembly error", this means that either your projects or their references were built with a reference to a specific version of an assembly which is missing from your bin directory or GAC.


1 Answers

Here's how I managed to solve it:

Go to the solution explorer and choose Antlr under References, right-click and say properties. Make sure the file version is the same the compiler is looking for. In my case, MSBuild wanted version 5.5.0.2, but the reference properties showed an earlier 2.x version.

All I had to do is go to the package manager console and type:

PM> update-package Antlr

Then build the project again, and in-case you get the same error for more assemblies, update them as well. Your issue will be resolved

like image 117
galdin Avatar answered Oct 10 '22 19:10

galdin