Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/.net/20.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/visual-studio-2008/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 即使I';您是否引用了System.XML?_C#_.net_Xml_Reference_Namespaces - Fatal编程技术网

C# 即使I';您是否引用了System.XML?

C# 即使I';您是否引用了System.XML?,c#,.net,xml,reference,namespaces,C#,.net,Xml,Reference,Namespaces,我引用了System.Xml: using System.Xml; 那么在这一行: XmlDocument xdoc = new XmlDocument(); 我得到: 类型或命名空间名称 找不到“XmlDocument” 可能有什么问题 信息: NET 3.5,C#,三次检查它是否在同一文档中被引用和使用,是否能够使用类似的甚至子库(System.Linq;System.Xml.Linq;System.Xml.XPath;System.Xml;)您是否正在SilverLight项目中工作

我引用了System.Xml:

using System.Xml;
那么在这一行:

XmlDocument xdoc = new XmlDocument();
我得到:

类型或命名空间名称 找不到“XmlDocument”

可能有什么问题

信息:


NET 3.5,C#,三次检查它是否在同一文档中被引用和使用,是否能够使用类似的甚至子库(System.Linq;System.Xml.Linq;System.Xml.XPath;System.Xml;)

您是否正在SilverLight项目中工作


我唯一一次经历这种情况是在SilverLight中起步时,我没有意识到并非所有System.XML都在SilverLight CLR版本中。我改用System.Linq.XML。

确保您的项目引用System.XML.dll程序集。您可能正在引用另一个包含其他System.Xml.*类的程序集,这可能就是您看到System.Xml命名空间但没有所需类的原因


如果您已经有了此参考,请尝试删除并重新添加它,看看这是否解决了一些奇怪的VS故障。

我知道问题已经得到了回答,但我想为我遇到的非常类似的问题添加解决方案,这可能会帮助其他人:

在我的例子中,这是一个简单的拼写错误,甚至不是,这是一个大小写错误:
有两类:
XMLDocument
(来自msxml.h)和
XMLDocument
(来自System.Xml)。


确保你没有把它们混在一起!;-)

如果您使用的是Visual Studio代码,则需要包含.NET标准。如果您只需要System.Xml.Xml文档,也可以直接包含它。

我知道这是一个非常老的问题,但问题现在仍然存在。 我在一个Xamarin.Forms项目中,PCL项目的目标是一个不支持XmlDocument的概要文件(Profile111)我不得不使用System.Xml.Linq.XDocument。
我的项目目标Windows Phone和XmlDocument在此目标上不存在。

您是否尝试从头开始创建新项目?我似乎无法做到这一点,不知道是否存在版本不匹配或项目损坏。不,不是。令人惊讶的是,这是一个winforms c#.net 3.5项目=(