在.NET 4.0中无法找到的JavaScriptSerializer [英] Cannot find JavaScriptSerializer in .Net 4.0
问题描述
我似乎无法找到<一个href=\"http://msdn.microsoft.com/en-us/library/system.web.script.serialization.javascriptserializer.aspx\"><$c$c>JavaScriptSerializer$c$c>对象也不是Visual Studio 2010中在 System.Web.Script.Serialization
命名空间,我需要的东西序列化到JSON我究竟应该使用?
I cannot seem to find the JavaScriptSerializer
object nor the the System.Web.Script.Serialization
namespace within Visual Studio 2010. I need to serialize something to JSON what am I supposed to use?
是的,我已经包含了 System.Web.Extensions程序
(在System.Web.Extensions.dll)项目内。这就是为什么我觉得震惊吗?
And yes, I already included the System.Web.Extensions
(in System.Web.Extensions.dll) within the project. Which is why I am shocked?
- 我知道
System.Web.Extensions程序
标记为<一个href=\"http://weblogs.asp.net/jeff/archive/2008/07/09/any-bets-on-whether-or-not-javascriptserializer-will-really-be-obsolete.aspx\">obsolete在3.5
- I do know
System.Web.Extensions
was marked as obsolete in 3.5
推荐答案
检查是否包含dot.net 4版 System.Web.Extensions程序
- 有一个3.5版本很好,我不认为在工作。
Check if you included the dot.net 4 version of System.Web.Extensions
- there's a 3.5 version as well, and I don't think that on works.
这些步骤为我工作:
- 创建一个新的控制台应用程序
- 更改目标dot.net,而不是客户端配置文件4
- 添加引用
System.Web.Extensions程序
(4.0) - 则获得了
的JavaScriptSerializer
Program.cs中现在: - )
- Create a new console application
- Change the target to dot.net 4 instead of Client Profile
- Add a reference to
System.Web.Extensions
(4.0) - Got access to
JavaScriptSerializer
in Program.cs now :-)
这篇关于在.NET 4.0中无法找到的JavaScriptSerializer的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!