This project has moved. For the latest updates, please go here.


Portable version of Json.NET not compatible with WP7 version


The WP7 version of Json.NET isn't strong name signed. The portable version is. This means that portable code using Json.NET won't work with the WP7 version of Json.NET. Unfortunately I think fixing this (by strong name signing the WP7 version) would break compatibility for existing WP7 packages built against the unsigned version.

Create a new Windows Phone 7.1 application
Add a new Portable Class Library project to the solution. For target frameworks, choose .NET 4.5, SL4, WP7.5, and .NET for Windows Store apps
Reference the Portable Class Library project from the Windows Phone project.
Reference the Json.NET NuGet package from BOTH projects
Add code to use Json.NET (ie new JObject()) in the portable project and call it from the Phone project (ie in the MainPage constructor)
Run the app in the WP7 (not WP8) emulator

Expected: code runs successfully
Actual: System.TypeLoadException: File or assembly name 'Newtonsoft.Json, Version=, Culture=neutral, PublicKeyToken=30AD4FE6B2A6AEED', or one of its dependencies, was not found.

file attachments

Closed Jan 3, 2013 at 8:47 PM by JamesNK
Why are you reopening this? All Json.NET assemblies in NuGet are signed.


JamesNK wrote Oct 30, 2012 at 2:22 AM

I think you can go from unsigned to signed without anything breaking. There are signed dlls for WP and Silverlight in the download from CodePlex. Try them in the bin directory and see what happens.

wrote Nov 4, 2012 at 1:29 AM

JamesNK wrote Jan 3, 2013 at 3:12 PM

I tested and I got some weird results but I think that WP is happy with a signed dll replacing an unsigned one.

** Closed by JamesNK 11/3/2012 6:29 PM

dsplaisted wrote Jan 3, 2013 at 3:12 PM

The problem isn't with a signed DLL replacing an unsigned one, it's the other way around. A portable library referencing the NuGet package would have a referenced to a signed version of Json.NET. If a WP7 app also references the NuGet package, it would get the unsigned version, and when the portable library tries to load the signed version it will fail.

This is also discussed here:

wrote Jan 3, 2013 at 8:47 PM

wrote Feb 22, 2013 at 1:47 AM

wrote May 16, 2013 at 12:36 PM