Does anyone know of a way to programmatically read the list of References in a VS2008 csproj file? MSBuild does not appear to support this functionality. I'm trying to read the nodes by loading the csproj file into an XmlDocument but, the XPath search does not return any nodes. I'm using the following code:
System.Xml.XmlDocument projDefinition = new System.Xml.XmlDocument();
projDefinition.Load(fullProjectPath);
System.Xml.XPath.XPathNavigator navigator = projDefinition.CreateNavigator();
System.Xml.XPath.XPathNodeIterator iterator = navigator.Select(@"/Project/ItemGroup");
while (iterator.MoveNext())
{
Console.WriteLine(iterator.Current.Name);
}
If I can get the list of ItemGroups I can determine whether it contains Reference information or not.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…