I am for sure missing some important detail here. I just cannot make .NET\'s XPath work with Visual Studio project files.
Let\'s load an xml document:
Look at the root namespace; you'll have to include an xml-namespace manager and use queries like "//x:ItemGroup", where "x" is your designated alias for the root namespace. And pass the manager into the query. For example:
XmlDocument doc = new XmlDocument();
doc.Load("my.csproj");
XmlNamespaceManager mgr = new XmlNamespaceManager(doc.NameTable);
mgr.AddNamespace("foo", doc.DocumentElement.NamespaceURI);
XmlNode firstCompile = doc.SelectSingleNode("//foo:Compile", mgr);