“找到的程序集的清单定义与程序集引用不匹配".在nuget包上 [英] "The located assembly's manifest definition does not match the assembly reference" on nuget package

查看:145
本文介绍了“找到的程序集的清单定义与程序集引用不匹配".在nuget包上的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以我一直在System.Web.Optimization包上遇到此错误

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

无法加载文件或程序集"System.Web.Optimization"或其依赖项之一.找到的程序集的清单定义与程序集引用不匹配. (来自HRESULT的异常:0x80131040)

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)

推荐答案

经过反复尝试,我终于找到了解决方案. 关键是在程序集"负载跟踪中.

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:

  • 卸载nuget软件包 Microsoft.AspNet.WebOptimization.WebForms

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

删除bin文件夹

打开web.config并找到重定向.

open web.config and locate the redirection.

它看起来像这样:

<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>

  • 我从web.config中删除了整个assemblyBinding部分.

    • I removed the entire assemblyBinding section from the web.config.

      最后重新安装Microsoft.AspNet.WebOptimization.WebForms 打包并重建.

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

      我不知道此部分在web.config中来自何处,但是将其删除后,一切似乎又可以正常工作了.

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

      这篇关于“找到的程序集的清单定义与程序集引用不匹配".在nuget包上的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆