Nan Li
Nan Li

Reputation: 593

Error with Json.NET in Portable Class Library

I created a Portable Class Library that targets .Net 4.5, Silverlight 4 and higher, Windows Phone 7 and higher and Windows Store.

Then I downloaded Json.NET from http://json.codeplex.com, referenced the Newtonsoft.Json.dll from the Bin\Portable folder, add "using Newtonsoft.Json;" to my class, but when I compile it, I got the error:

The type or namespace name 'Newtonsoft' could not be found (are you missing a using directive or an assembly reference?)

But I've already referenced it. Did I use the wrong version?

I also tried using Nuget to get Json.NET directly from my PCL project, but the one got added to my project only contains a very small set of functionalities (no async versions and no SerializeXNode on JsonConvert object).

Upvotes: 2

Views: 893

Answers (2)

Benyamin Maengkom
Benyamin Maengkom

Reputation: 139

Already add from Nuget Microsoft.Bcl.Async ?

Upvotes: 0

Daniel Plaisted
Daniel Plaisted

Reputation: 16744

Make sure your Portable Class Library is targeting Windows Phone 7.5 and not just Windows Phone 7.0. However, it may be that the PCL version of Json.NET which supports WP7.5 doesn't have the features you are looking for. WP7.5 doesn't have async support without the Microsoft.Bcl.Async NuGet package, for example, and I don't know if Json.NET took advantage of that.

Upvotes: 0

Related Questions