无法加载文件或程序集'Newtonsoft.Json,版本= 7.0.0.0 [英] Could not load file or assembly 'Newtonsoft.Json, Version=7.0.0.0

查看:546
本文介绍了无法加载文件或程序集'Newtonsoft.Json,版本= 7.0.0.0的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正面临以下错误

无法加载文件或程序集'Newtonsoft.Json,Version = 7.0.0.0, 文化=中性,PublicKeyToken = 30ad4fe6b2a6aeed"或其中之一 依赖关系.找到的程序集的清单定义不 匹配程序集参考. (来自HRESULT的异常:0x80131040)

Could not load file or assembly 'Newtonsoft.Json, Version=7.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)

我可以在Web.config中看到以下内容

I could see the below in Web.config

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

所以我将其更改为

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

在packeges.config中,我可以看到以下条目

In packeges.config I could see the below entry

但是我仍然面临着同样的问题.请帮忙

But still I am facing the same issue. Please help

推荐答案

很多事情都可能出错,并且此错误消息什么也没有告诉您.

A lot of things can go wrong and this error message tells you nothing.

但是我仍然面临着同样的问题.

But still I am facing the same issue.

也许最简单的方法是尝试重新安装该软件包.

Maybe the easiest way will be to try and reinstall the package.

转到工具> NuGet软件包管理器,然后选择 Package Manager控制台.执行以下两个命令:

Go to TOOLS > NuGet Package Manager and Select Package Manager Console. Execute the following two commands:

uninstall-package newtonsoft.json -force
install-package newtonsoft.json

如果执行此操作后仍然出现错误,那么最终对我有用的是我从.config文件中删除了Json.Net的部分.如果不存在,重新安装会将其恢复,显然您需要删除它.除非在包装本身中提供正常的解决方案,否则恐怕必须手动执行此步骤.在程序包管理器控制台中,再次执行:

If you still get an error after doing this, then what worked for me eventually is that I deleted Json.Net's section from my .config file. Reinstall brings it back if it's not there and apparently you need to delete it. Until there will be a normal solution in the package itself, I'm afraid this manual step is a must. In package manager console again execute:

Update-Package –reinstall Newtonsoft.Json

也请查看您的这是 查看全文

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