Try using XElement as following, make sure you specify the namespace for each element you query:
XElement xml= XElement.Load("file.xml");
XNamespace ns= xml.Name.Namespace;
var groups = xml.Elements(ns+ "ItemGroup");
if you don't want to use ns
everywhere, you can load the xml, go through all elements and set the namespace attribute to empty string, or you can implement custom method to give you the correct name:
public static XNamespace ns = @"http://schemas.microsoft.com/developer/msbuild/2003";
public static XName MsElementName(string baseName)
{
return ns + baseName;
}
and use it like following:
var groups = xml.Elements(MsElementName("ItemGroup"));