Cannot find JavaScriptSerializer in .Net 4.0
- Right click
References
and doAdd Reference
, then fromAssemblies->Framework
selectSystem.Web.Extensions
. - Now you should be able to add the following to your class file:
using System.Web.Script.Serialization;
Check if you included the .net 4 version of System.Web.Extensions
- there's a 3.5 version as well, but I don't think that one works.
These steps work for me:
- Create a new console application
- Change the target to .net 4 instead of Client Profile
- Add a reference to
System.Web.Extensions
(4.0) - Have access to
JavaScriptSerializer
in Program.cs now :-)
From the first search result on google:
http://msdn.microsoft.com/en-us/library/system.web.script.serialization.javascriptserializer.aspx
JavaScriptSerializer Class
Provides serialization and deserialization functionality for AJAX-enabled applications.
Inheritance Hierarchy
System.Object
System.Web.Script.Serialization.JavaScriptSerializer
Namespace: System.Web.Script.Serialization
Assembly: System.Web.Extensions (in System.Web.Extensions.dll)
So, include System.Web.Extensions.dll
as a reference.