“The located assembly's manifest definition does not match the assembly reference” on nuget package

烈酒焚心 提交于 2019-12-07 06:08:53

问题


So I was persistently getting this error on the System.Web.Optimization package

Could not load file or assembly 'System.Web.Optimization' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)


回答1:


I finally found the solution after much trying. The key was in the Assembly load trace.

LOG: Redirect found in application configuration file: 1.0.0.0 redirected to 1.1.0.0.

Here are the steps I took to resolve the issue. It might be possible to skip some of these but this worked for me:

  • Uninstall the nuget package Microsoft.AspNet.WebOptimization.WebForms

  • Delete bin folder

  • open web.config and locate the redirection.

It will look something like this:

<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
  <dependentAssembly>
    <assemblyIdentity name="System.Web.Optimization" publicKeyToken="31bf3856ad364e35" culture="neutral" />
    <bindingRedirect oldVersion="0.0.0.0-1.1.0.0" newVersion="1.1.0.0" />
  </dependentAssembly>
</assemblyBinding>
  • I removed the entire assemblyBinding section from the web.config.

  • Finally re-install the Microsoft.AspNet.WebOptimization.WebForms package and rebuild.

I don't know where this section came from in the web.config but having removed it everything seems to be working once again.



来源:https://stackoverflow.com/questions/19134304/the-located-assemblys-manifest-definition-does-not-match-the-assembly-referenc

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