程序集寻找错误版本的Newtonsoft.Json.dll [英] Assembly looking for wrong version of Newtonsoft.Json.dll

查看:225
本文介绍了程序集寻找错误版本的Newtonsoft.Json.dll的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的项目正在使用Newtonsoft.Json.dll. 我已经添加了dll作为对我的项目和即时消息的引用,使用的是8.0.2版

My project is using Newtonsoft.Json.dll. I have added the dll as a reference to my project and im using version 8.0.2

一切都可以在我的PC上运行,但是当我将所有内容与Newtonsoft.Json.dll一起转移到新PC上时

Everything works on my pc however when i transfer everything to a new pc along with Newtonsoft.Json.dll i get the error

无法加载文件或程序集'Newtonsoft.Json,版本= 4.0.3.0, Culture = neutral,PublicKeyToken = 30ad4fe6b2a6aeed"或其中之一 依赖关系.系统找不到指定的文件.

Could not load file or assembly 'Newtonsoft.Json‚ Version=4.0.3.0‚ Culture=neutral‚ PublicKeyToken=30ad4fe6b2a6aeed' or one of its dependencies. The system cannot find the file specified.

我没有在任何地方引用该版本,并且我的app.config中没有任何内容指定该版本.

Im not referencing that version anywhere and there is nothing in my app.config specifying this.

推荐答案

上一个答案将帮助您找到问题所在.当某些引用的库明确指定了它支持的库版本时,就会发生这种情况.幸运的是,您可以在app.config中覆盖绑定(请参见下面的示例):

The previous answer will help you to track down the problem. It happens when some referenced library explicitly specified a version of library that it supports. Fortunately, you can override binding in app.config (see example below):

<configuration>
  <!--YOUR CONFIG -->
  <runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <dependentAssembly>
        <assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
        <bindingRedirect oldVersion="0.0.0.0-8.0.0.0" newVersion="8.0.0.0" />
      </dependentAssembly>
    </assemblyBinding>
  </runtime>
</configuration>

这篇关于程序集寻找错误版本的Newtonsoft.Json.dll的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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