nugetasp.net-mvc-5antlr3

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


Solution

  • 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