Import these namespace also
using System.Xml.Linq;
public void LoadAssembly(string path)
{
int result=0;
XNamespace msbuild = "http://schemas.microsoft.com/developer/msbuild/2003";
XDocument projDefinition = XDocument.Load(path);
IEnumerable<string> references = projDefinition.Element(msbuild + "Project")
.Elements(msbuild + "ItemGroup")
.Elements(msbuild + "Reference")
.Elements(msbuild + "Name")
.Select(refElem => refElem.Value);
foreach (string reference in references)
{
Environment.NewLine); }richTextBox1.AppendText(reference);
richTextBox1.AppendText(
}
If you need to loop through the IEnumerable iterator to find out other xml nodes u can use the following
using (IEnumerator<string> enumerator = references.GetEnumerator())
{
while (enumerator.MoveNext())
result++;
}
if (result == 0)
{
//Do ur xml operations
}
0 comments:
Post a Comment