zoukankan      html  css  js  c++  java
  • dll版本冲突的解决方法

    问题描述

    当运行站点或者控制台等程序时,如果项目引用的dll版本与其它dll所依赖的dll版本不一致,就会报未能加载程序集的错误。错误信息为:

    未能加载文件或程序集“Newtonsoft.Json, Version=4.5.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed”或它的某一个依赖项。找到的程序集清单定义与程序集引用不匹配。 (异常来自 HRESULT:0x80131040)

    原因分析

    分析如下图。

    clipboard

    解决方案

    在web.config或app.config中添加以下节点。

      1 <!--dll版本向下兼容-->
      2   <runtime>
      3     <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      4       <dependentAssembly>
      5         <assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
      6         <bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0" />
      7       </dependentAssembly>
      8     </assemblyBinding>
      9   </runtime>
     10 
    View Code
  • 相关阅读:
    lamp
    ssh 交互脚本
    mysql 备份检测主从脚本
    RANDOM 猜数字脚本
    ansible+playbook 搭建lnmp环境
    集群搭建
    grafana
    nginx lnmp搭建
    shell 基础(1): 变量
    seq 增量输出命令
  • 原文地址:https://www.cnblogs.com/mcgrady/p/5674428.html
Copyright © 2011-2022 走看看