当我尝试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`
发布评论