views:

208

answers:

2

I've referenced System.Xml:

using System.Xml;

Then in this line:

XmlDocument xdoc = new XmlDocument();

I get:

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

What could there possibly be wrong ?

Info:

.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;)

A: 

Are you perhaps working inside a SilverLight project?

Only time I have experienced this was when starting out in SilverLight, I did not realise that not all of the System.XML was in the Silverlight CLR version. I used System.Linq.XML instread.

Kindness,

Dan

Daniel Elliott
Nope it isnt. Surprisingly enough it's a winforms c# .net 3.5 project =(
MarceloRamires
+3  A: 

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.

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

Keith