c# - 错误 CS0234 : The type or namespace name 'Script' does not exist in the namespace 'System.Web'

标签 c# visual-studio-2010 javascriptserializer jsonserializer

我正在尝试在我的应用程序中使用 JavaScriptSerializer

我最初收到了

Cannot find JavaScriptSerializer

我通过添加解决了这个问题:

using System.Web.Script.Serialization;

但是子关键字 Script 带有蓝线下划线:

The type or namespace 'Script' does not exist in the namespace 'System.Web' (are you missing an assembly reference?)

所以我在项目中添加了对以下内容的引用:

C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework.NETFramework\v4.0\System.Web.Extensions.dll

那没有帮助。我仍然收到相同的蓝色下划线和相同的错误。引用标有感叹号黄色警告:

enter image description here

我在 this thread 上尝试了建议的解决方案,但正如@user781490 所指出的,他们对我的情况没有帮助。

知道如何解决这个问题吗?

最佳答案

我也一样。脚本已加下划线。我添加了对 System.Web.Extensions 的引用。此后,脚本不再有下划线。希望这对某人有帮助。

关于c# - 错误 CS0234 : The type or namespace name 'Script' does not exist in the namespace 'System.Web' ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13035192/

相关文章:

jquery - 为什么 Web 服务返回数据为 msg.d

c# - 序列化(TextWriter,“对象”)与序列化(XmlWriter,“对象”)

c# - 调用 .NavigateToUrl(Uri uri) 时 BrowserWindow.Uri 属性未更新

c# - 在C#中比较两个日期并计算差值

连接调试器时 ASP.Net Worker 进程卡住

c# - 为什么 c# JavaScriptSerializer.Serialize 返回空方括号

c# - SqlConnectionStringBuilder 类在 dotnetcore 中缺少 Authentication 属性

visual-studio-2010 - Visual Studio 2010 Express。写入输出窗口

c++ - 为 GreedyProjectionTriangulation 配置 VS2010

c# - 如何反序列化 Json 对象 - C#