We're a community of 1077K IT Pros here for help, advice, solutions, professional growth and fun. Join us!
1,076,263 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Start New Discussion Reply to this Discussion

Could not load file or assembly 'Newtonsoft.Json, Version=4.0.3.0

Hi everyone,

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

2
Contributors
1
Reply
15 Minutes
Discussion Span
1 Year Ago
Last Updated
2
Views
sagngh8
Newbie Poster
10 posts since May 2011
Reputation Points: 10
Solved Threads: 0
Skill Endorsements: 0

1) Add both assemblies to your project.
2) Right click the first assembly and select Properties
3) Change the Aliases field from 'global' to something else, like 'Version4000'
4) Do the same with the second assembly, but with a different alias, 'Version4030'
5) add these lines to the top of your code file

extern alias Version4000;
extern alias Version4030;

6) When you need something from a specific assembly, prefix the alias:

Console.WriteLine(Version4000::MyLibrary.MyClass.MyMethod());
Console.WriteLine(Version4030::MyLibrary.MyClass.MyMethod());

Version4000::MyClass v4000Class = new Version4000::MyClass();
Version4030::MyClass v4030CLass = new Version4030::MyClass();
Momerath
Senior Poster
3,729 posts since Aug 2010
Reputation Points: 1,322
Solved Threads: 624
Skill Endorsements: 13

This article has been dead for over three months: Start a new discussion instead

Post: Markdown Syntax: Formatting Help
 
You
View similar articles that have also been tagged:
 
© 2013 DaniWeb® LLC
Page rendered in 0.1296 seconds using 2.67MB