Forum Cross Platform with Xamarin

JSON.NET on PCL - Build Error

Added Package from NuGet on PCL (Cross Platform) and used JsonConvert.DeserializeObject(JsonString)

Build Error: iOS/MTOUCH: Error MT2002: Failed to resolve assembly: 'Newtonsoft.Json, Version=, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed' (MT2002)

Please help.


  • stvansolanostvansolano UMInsider, University ✭✭✭

    Hello Dennis,

    It looks like the package you added depends on JSON.Net, so should added it too from NuGet as well. Try run this from package console:

    Install-Package Newtonsoft.Json

  • DennisAbrahamDennisAbraham USMember ✭✭

    Hello Stvansolano,

    Thanks much for your reply.

    I had already added from Nuget. On Xamarin MAC I don't see a console where I can install the same from a console. Please correct me if I am wrong.

  • DennisAbrahamDennisAbraham USMember ✭✭

    Since I didn't have any luck with accessing on PCL.

    I decided to not use PCL or Shared lib instead have just one iOS project and use Xamarin Forms inside - I understand this defeated the purpose of code sharing between iOS and Droid. Don't know what other problems I will run into.

    By doing this I was able to use RestSharp by downloading RestSharp component from component library.

  • tom-smallstom-smalls GBMember ✭✭

    I ran into a similar issue with Newtonsoft.Json but with version 9.0.1 installed; the missing assembly was

    I fixed (read: "this is not a fix") this by copying the Newtonsoft.Json.9.0.1 directory in my packages directory, with the copy called Newtonsoft.Json. I also renamed the .nupkg file too.

  • RamiresMoreiraRamiresMoreira USMember

    in my case this error ocurred because I didn't install the library in all the projects, I had instaled only on PCl.
    after these changes my app worked perfectly

  • eliza.brisaneliza.brisan ROMember ✭✭

    I have the same error. But in the PCL I have version 10 of (and I cannot downgrade or uninstall it) and the error is "System.Void Newtonsoft.Json.Serialization.DefaultContractResolver::set_IgnoreSerializableAttribute(System.Boolean)" reference from "Newtonsoft.Json, Version=, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed" .

    I also tried to install the same version as in PCL in the ios project , or downgrade it to 6, but the error is still there.
    Do you have any other suggestions?

Sign In or Register to comment.