Hello again...
I found the
ms-help://MS.VSCC.v80/MS.MSDN.v80/MS.NETDEVFX.v20.en/CPref0/html/T_Microsoft_Build_BuildEngine_Project.htm
document very useful
a Microsoft.Build.BuildEngine.Project class that "Represents a project
that can be built using MSBuild." and A Project represents an MSBuild
project. It is a container for items, properties and targets. It can
load project content from in-memory XML or from an XML file, and can
save to an XML file, preserving most whitespace and all XML comments."
I think that is all I need...
using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.Build.BuildEngine;
namespace ListItemAndPropertiesCS
{
class Program
{
static void Main(string[] args)
{
// SET THIS TO POINT TO THE RIGHT LOCATION
Engine.GlobalEngine.BinPath =
@"C:\Windows\Microsoft.NET\Framework\v2.0.xxxxx";
// Create a new empty project
Project project = new Project();
// Load a project
project.Load(@"c:\temp\validate.proj");
Console.WriteLine("Project Properties");
Console.WriteLine("----------------------------------");
// Iterate through the various property groups and
subsequently
// through teh various properties
foreach (BuildPropertyGroup propertyGroup in
project.PropertyGroups)
{
foreach (BuildProperty prop in propertyGroup)
{
Console.WriteLine("{0}:{1}", prop.Name,
prop.Value);
}
}
Console.WriteLine();
Console.WriteLine("Project Items");
Console.WriteLine("----------------------------------");
// Iterate through the various itemgroups
// and subsequently through the items
foreach (BuildItemGroup itemGroup in project.ItemGroups)
{
foreach (BuildItem item in itemGroup)
{
Console.WriteLine("{0}:{1}", item.Name,
item.Include);
}
}
}
}
}
/Magnus