How to fix Error Type 'System.Web.Script.Serialization.JavaScriptSerializer' is not defined

蹲街弑〆低调 提交于 2020-07-08 06:12:06

问题


The super obvious way is to add reference to System.web

I did that. It doesn't work.


回答1:


Add a reference to System.Web.Extensions

http://msdn.microsoft.com/en-us/library/system.web.script.serialization.javascriptserializer.aspx

Namespace: System.Web.Script.Serialization

Assembly: System.Web.Extensions (in System.Web.Extensions.dll)




回答2:


How to add System.Web.Extensions in Visual Studio 2012:

  • Right-click your project.
  • Click "Properties"
  • Click the "References" tab on the left.
  • Click the "Add" button
  • Click "Assemblies"
  • Click "Framework"
  • Scroll down and find "System.Web.Extensions" and check the box next to it, then click OK, and save the Properties window.
  • Type Imports System.Web.Script.Serialization at the top of your file (or, for C# using System.Web.Script.Serialization;)

I just had to figure this out, and it took me way longer than it should have to find the answer, so maybe that will help someone.



来源:https://stackoverflow.com/questions/19467109/how-to-fix-error-type-system-web-script-serialization-javascriptserializer-is

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!