无法导入`导入System.Web.Script.Serialization` [英] Cannot import `Imports System.Web.Script.Serialization`

查看:311
本文介绍了无法导入`导入System.Web.Script.Serialization`的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我尝试Imports System.Web.Script.Serialization时,我在VB 2010中收到一条错误消息:

When I try to Imports System.Web.Script.Serialization, I get an error in VB 2010 that says:

警告:导入System.Web.Script.Serialization"中指定的命名空间或类型不包含任何公共成员,或者找不到.确保定义了名称空间或类型,并且至少包含一个公共成员.确保导入的元素名称不使用任何别名.

Warning: Namespace or type specified in the Imports System.Web.Script.Serialization doesn't contain any public member or cannot be found. Make sure the namespace or the type is defined and contains at least one public member. Make sure the imported element name doesn't use any aliases.

不确定为什么我不能导入它.

Not sure why I can't import it.

推荐答案

您可能缺少对System.Web.Extensions.dll的程序集引用.将此引用添加到您的项目中,然后重试.

You might be missing an assembly reference to System.Web.Extensions.dll. Add this reference to your project, then try again.

通常来说,遇到此问题时,请转到您要使用的类型的.NET API参考页.例如 JavaScriptConverter —并查找命名空间"和程序集"提示(确保您正在查看正在使用的.NET Framework版本的页面):

Generally speaking, when you encounter this issue, go to the .NET API reference page of the type you want to use — for instance, JavaScriptConverter — and look out for the Namespace and Assembly hints (make sure you're looking at the page for the .NET framework version that you are using):

  • 命名空间:告诉您要在Imports指令中添加什么.
  • 程序集::告诉您在项目中需要引用的程序集(例如,转到 Solution Explorer ,找到 References ,然后选择从上下文菜单中添加引用….
  • Namespace: tells you what to put in the Imports directive.
  • Assembly: tells you what assembly you need to reference in your project (e.g. go to Solution Explorer, locate References, and select Add Reference… from the context menu).

这篇关于无法导入`导入System.Web.Script.Serialization`的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆