的XmlDocument类型未发现即使我引用了System.XML?使我、类型、发现、XmlDocument

2023-09-05 02:22:51 作者:一路繁花相送

我引用的System.Xml:

I've referenced System.Xml:

using System.Xml;

然后在这行:

Then in this line:

XmlDocument xdoc = new XmlDocument();

我得到:

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

The type or namespace name 'XmlDocument' could not be found

还有什么比有可能是错的?

What could there possibly be wrong ?

信息:

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

.NET 3.5, C#, triple checked that it's referenced and used in the same document, been able to use similar and even child libraries (System.Linq;System.Xml.Linq;System.Xml.XPath; System.Xml;)

推荐答案

请确保您的项目引用system.xml.dll的组装。这有可能是你引用含有其他的System.Xml程序集。*类和这可能是为什么你看到System.Xml命名空间,但没有你需要的类。

Make sure your project references the System.Xml.dll assembly. It's possible that you're referencing an assembly containing other System.Xml.* classes and that might be why you're seeing the System.Xml namespace but without the classes you need.

如果你已经有了这个参考,请尝试删除并重新添加它,看看是否铁杆出一些怪异VS故障。

If you already have this reference, try removing and re-adding it and see if that irons out some weird VS glitch.