【问题标题】:Reference References Old Dll and Throws Error参考参考旧 Dll 并引发错误
【发布时间】:2017-01-10 23:55:45
【问题描述】:

我正在使用 TwitchLib 参考并使用 Newtonsoft.Json 7.0.0。每次我进入调用 Twitch lab 的页面时,都会收到以下错误。

无法加载文件或程序集 'Newtonsoft.Json, Version=7.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed'

我的项目中安装了 Newtonsoft.Json,Version=9.0.0.1。

我已将此添加到我的配置中以尝试解决问题。

  <dependentAssembly>
    <assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
    <bindingRedirect oldVersion="0.0.0.0-7.0.0.0" newVersion="7.0.0.0" />
  </dependentAssembly>

我该如何解决这个问题?

【问题讨论】:

  • ..newVersion="7.0.0.0"..
  • 为什么你有newVersion="7.0.0.0" 和“在我的项目中安装了Newtonsoft.Json, Version=9.0.0.1。”同时?
  • 我手动添加了这个程序集,并从上面的 6.0.0 版本进行了复制和粘贴,但没有正确读取。

标签: c# json json.net


【解决方案1】:

在 Nuget 包管理器控制台中:

Uninstall-Package Newtonsoft.Json -Force

Install-Package Newtonsoft.Json -Version 6.0.0.0

请看这里:How to install an older version of package via NuGet?

【讨论】:

    【解决方案2】:

    将引用 newVersion="7.0.0.0" 更改为 newVersion="9.0.0.0" 似乎已经解决了问题。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2013-06-13
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-08-15
      • 2013-02-11
      • 2015-07-30
      • 2018-03-12
      相关资源
      最近更新 更多