zoukankan      html  css  js  c++  java
  • 无法加载文件或程序集“Newtonsoft.Json”或它的某一个依赖项

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

    有时候我们创建了一个类库,我们项目又引用了这个类库,需要我们把Newtonsoft.Json统一化。

    对每个引用Newtonsoft.Json的项目做下面的处理:

    ①删除bin下面的Newtonsoft.Json.dll

    ②重新nuget引用Newtonsoft.Json到一个版本(看实际情况,一般是最新)

    ③添加我们的依赖,然后重新生成

     version="1.0" encoding="utf-8"?>
    <configuration>
      <runtime>
        <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
          <dependentAssembly>
            <assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
            <bindingRedirect oldVersion="0.0.0.0-12.0.0.0" newVersion="4.5.0.0" />   <!-- newVersion 一般都是你在nuget种引用的版本的  -->  
          </dependentAssembly>
        </assemblyBinding>
      </runtime>
    </configuration>

    特殊情况:

    如果你这样做了还是报错,列如:

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

    执行上面的步骤,把Newtonsoft.Json引用到报错的版本

  • 相关阅读:
    python appium环境搭建
    github 删除某个文件
    python 导入的模块使用了相对路径,导致找不到文件错误
    python asyncio协程
    python 获取调用函数的名字和行号
    monkey测试命令
    python 属性查询顺序,数据描述符
    JS各循环的差别
    AngularJS复习小结
    那些不正经的前端笔试题
  • 原文地址:https://www.cnblogs.com/Sea1ee/p/10575356.html
Copyright © 2011-2022 走看看