无法加载文件或程序集Ne​​wtonsoft.json.dll [英] Could not load file or assembly Newtonsoft.json.dll

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

问题描述

请帮助我在此。

无法加载文件或程序集Newtonsoft.Json,版本= 4.0.3.0,文化=中性公钥= 30ad4fe6b2a6aeed或它的某一个依赖。找到的程序集清单定义不匹配的程序集引用。 (从HRESULT异常:0x80131040)。

"Could not load file or assembly 'Newtonsoft.Json, Version=4.0.3.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)".

NewtonsoftJson.dll组件需要发布到二手.The版本为4.0.3.0。

'NewtonsoftJson.dll’ assembly is required for posting to twitter .The version used is 4.0.3.0.

和相同的组件(但差异版本4.0.0.0)作为被Facebook C#API(DLL)的依赖程序集。然而,上述组件(4.0.3.0)不适用于这两种情况下工作(即张贴到Twitter和用于登录到Facebook的)。为了解决这个问题,创建一个单独的项目张贴到Twitter,并分别引用组件(4.0.3.0)(在项目Twitter发布)。而另外一个版本(4.0.0.0)作为为Facebook主项目引用但仍是错误comes.If叽叽喳喳项目被禁用,跑那么Facebook登录工作正常,副症。

And the same assembly(but diff version 4.0.0.0) is used as the dependent assembly by facebook C# api(dll). However the above assembly(4.0.3.0) does not work for both the cases (ie for posting to twitter and for login to facebook). In order to solve it ,created a separate project for posting to twitter and reference the assembly(4.0.3.0) separately (in the project for twitter post).And another version(4.0.0.0) was added as reference in main project for facebook but still the error comes.If twitter project is disabled and ran then the facebook login works fine and vice vera.

我已经做了很多的研究和尝试以下操作。

I have done lot of research and tried the following.

删除临时asp.net文件 清洁解决方案 重新启动计算机

delete temporary asp.net files clean solution restart computer

甚至试图卸载从GAC大会(但是它不是那里注册)。

Even tried to uninstall the assembly from gac(however its not registered there).

请帮我在这是它不工作。 谢谢, 小号

Please help me on this as its not working. Thanks, S

推荐答案

目前还不清楚是什么项目的关系,或当这个错误是发生,但这里有一个猜测。

It's not clear what the relationships of the projects are, or when this error is occuring, but here's a guess.

您有3个项目在facebook的项目(参4.0.0.0版本),Twitter的项目(参4.0.3.0版本),以及一个主项目,裁判这两个项目。您可能能够建立这样的解决方案,但是当你运行程序集绑定将失败。为什么?因为默认行为是在运行之前,本地复制组件。什么情况是,第一个项目,以建立副本斌(说唧唧喳喳),那么第二个项目生成(脸谱),然后主。然而,在这个的4.0.0.0版本的结束是坐bin文件夹。当你运行,只要你调用从Twitter的东西,尝试使用绑定失败,因为它不再拥有访问4.0.3.0版本的程序集的问题组装。

You have 3 projects the facebook project (refs 4.0.0.0 version), twitter project (refs 4.0.3.0 version), and a main project that refs both of those projects. You may be able to build this solution, but when you run the assembly binding will fail. Why? because the default behavior is to copy assemblies locally before running. What happens is that the first project to build copies to bin (say twitter) then the second project builds (facebook), then main. However, at the end of this the 4.0.0.0 version is sitting bin folder. When you run, as soon as you invoke something from twitter that tries to use the problem assembly the bind fails because it longer has access to the 4.0.3.0 version of the assembly.

有几个办法解决这个。一种是注册两个程序集在GAC中。如果这是不可行的,然后看看集绑定重定向在你的配置文件。另一种是注册为 AssemblyResolve事件并以编程方式加载程序集。

There are a couple of ways around this. One is register both assemblies in the GAC. If that isn't doable then look into assembly binding redirection in your config file. Another is to register for the AssemblyResolve event and load the assembly programmatically.

这篇关于无法加载文件或程序集Ne​​wtonsoft.json.dll的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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