Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cannot find DataContractJsonSerializer in VS2010

I am working on a demo Silverlight app and I'd like to do some simple JSON. I found the System.Runtime.Serialization.Json.DataContractJsonSerializer class on MSDN, but I can't seem to reference it successfully in Visual Studio 2010.

I have added a reference to System.Runtime.Serialization, but I still get a compile error if I have a DataContractJsonSerializer (even with a fully qualified class name. My project is configured to Silverlight 4. The assembly does have a 2.0 version number when I add the reference, but I can't find a version 4.0 assembly.

Why can't I use this class?

Namespace:  System.Runtime.Serialization.Json
Assembly:  System.Runtime.Serialization (in System.Runtime.Serialization.dll)
like image 604
C. Ross Avatar asked Jan 05 '11 13:01

C. Ross


1 Answers

There is a System.Runtime.Serialization.Json.dll file but that is not where you can find the System.Runtime.Serialization.Json namespace. You actually have to reference the System.ServiceModel.Web.dll library and that is where the DataContractJsonSerializer class. On my machine, the DLL was found here: C:\Program Files\Reference Assemblies\Microsoft\Framework\Silverlight\v4.0\System.ServiceModel.Web.dll

like image 179
Jim McCurdy Avatar answered Nov 15 '22 10:11

Jim McCurdy