首先,它不仅仅是重复的.以下问题的答案都没有对我有用.
First, It is not just duplicate. None of answers from following questions are working for me.
goo.gl/tS40cn goo.gl/pH6v2T
我刚刚使用Nuget软件包管理器更新了我的所有软件包,并且开始收到此错误.
I've just updated all my packages using Nuget Package Manager and I started receiving this error.
无法加载文件或程序集"Newtonsoft.Json,版本= 6.0.0.0,文化=中性,PublicKeyToken = 30ad4fe6b2a6aeed"或其依赖项之一.找到的程序集的清单定义与程序集引用不匹配. (来自HRESULT的异常:0x80131040)
我的软件包配置有:
<package id="Newtonsoft.Json" version="7.0.1" targetFramework="net45" />Web.config包含以下代码:
Web.config includes this piece of code:
<dependentAssembly> <assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" /> <bindingRedirect oldVersion="0.0.0.0-4.5.0.0" newVersion="4.5.0.0" /> </dependentAssembly>Newtonsoft.Json
根据类似问题的答案,我尝试了以下方法:
According to the answers from the similar questions, I have tried followings:
- 使用Update-Package –reinstall Newtonsoft.Json 重新安装软件包
- 从Web.config中删除dependentAssembly的Newtonsoft.Json
- 将newVersion更改为dependentAssembly中的6.0.0.0和7.0.0.0.这样做产生了新的错误.
- 也尝试了Get-Project -All | Add-BindingRedirect.它将Newtonsoft.Json的newVersion更改为4.5.0.0.但是问题仍然没有解决.
- Reinstalling package using Update-Package –reinstall Newtonsoft.Json
- Removing dependentAssembly config from Web.config for Newtonsoft.Json
- Changing newVersion to 6.0.0.0 and 7.0.0.0 in dependentAssembly. Doing so gave birth to new error.
- Also tried Get-Project -All | Add-BindingRedirect. It changes newVersion for Newtonsoft.Json to 4.5.0.0. But issue remains unresolved.
请帮助我解决此问题.
推荐答案我知道这很旧,但是我遇到了同样的问题.我的问题是该解决方案中的多个项目都使用Newtonsoft.Json,但是其中一些版本不同.我将所有这些都更新为最新版本(在我输入时为9.0.1),问题消失了.
I know this is old, but I just ran into the same problem. My issue was that multiple projects in the solution used Newtonsoft.Json, but some were at different versions. I updated all of them to the most recent (9.0.1 as I type) and the problem went away.
无论如何...如果仍然有人在处理此问题,请确保在解决方案中的每个项目中更新软件包.
Anyway... if anyone is still dealing with this, make sure to update the package in EVERY project in the solution.
HTH
更多推荐
无法加载文件或程序集"Newtonsoft.Json"或其依赖项之一
发布评论