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
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.
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 .
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.
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With