Assembly's manifest definition does not match assembly reference

随声附和 提交于 2019-11-29 09:21:20

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

This can happen if you have a rogue binding redirect in your configuration file, that points to a version you don't have.

In our case, we were referencing the PostSharp 5.0.50 Nuget package, and the following was present in our config file, which was causing it to look for PostSharp version 5.0.51 instead.

<dependentAssembly>
  <assemblyIdentity name="PostSharp" publicKeyToken="b13fd38b8f9c99d7" culture="neutral"/>
  <bindingRedirect oldVersion="0.0.0.0-5.0.51.0" newVersion="5.0.51.0"/>
</dependentAssembly>

I fixed it by removing the binding redirect, because it was not necessary. You could also fix it by changing the version of the binding redirect to the same version as the Nuget package you've referenced.

mukulsharma1146

I had the same error with my MVC 5 application. Tried everything from,

  • Installing and Reinstalling the Antlr packages
  • Deleting the %TEMP% data.

Fianlly i was able to solve the problem by simply deleting all the dlls from my project's bin folder and building the project again. Though I am still not sure about the real reason for this reference error.

I tried the above solution to update a specific package but that had no success but updating all packages did work. Using the package manager console;

update-package -Reinstall

Followed by a rebuild of the solution.

Update-Package -Reinstall Antlr

worked for me...

Also, when publishing ensure "Delete Existing Files" checkbox is checked.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!