“找到的程序集的清单定义与程序集引用不匹配".在nuget包上

编程入门 行业动态 更新时间:2024-10-23 20:29:32
本文介绍了“找到的程序集的清单定义与程序集引用不匹配".在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包上

本文发布于:2023-11-03 16:11:19,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1555539.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:程序   清单   不匹配   包上   定义

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!