打开APP
userphoto
未登录

开通VIP,畅享免费电子书等14项超值服

开通VIP
c#

Please help me on this.

“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’ assembly is required for posting to twitter .The version used is 4.0.3.0.

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.

delete temporary asp.net files clean solution restart computer

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

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

3 Answers


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

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.

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.

本站仅提供存储服务,所有内容均由用户发布,如发现有害或侵权内容,请点击举报
打开APP,阅读全文并永久保存 查看更多类似文章
猜你喜欢
类似文章
【热】打开小程序,算一算2024你的财运
解决方法:未能加载文件或程序集“Microsoft.Office.Interop.Excel。。
未能加载文件或程序集“XXX”或它的某一个依赖项,系统找不到指定的文件
如何一步一步自己做WebPart的CAB安装包
SharePoint 2013 workflows stop working (Failed on started.)
apache2 + git + gerrit + mysql 配备、简单git操作
Project structure best practices
更多类似文章 >>
生活服务
热点新闻
分享 收藏 导长图 关注 下载文章
绑定账号成功
后续可登录账号畅享VIP特权!
如果VIP功能使用有故障,
可点击这里联系客服!

联系客服