Engine engine = new Engine( AppDomain.CurrentDomain.BaseDirectory );
Project project = new Project( engine );
project.Load( @"D:\个人文件夹\我的文档\Visual Studio 2008\Projects\Demo\Demo.csproj" );
string assemblyName = project.GetEvaluatedProperty( "AssemblyName" );
IEnumerator enumerator = project.EvaluatedProperties.GetEnumerator();
while (enumerator.MoveNext())
{
BuildProperty property = enumerator.Current as BuildProperty;
if (property.Name.Equals( "AssemblyName" ))
{
System.Console.WriteLine( string.Format( "Key:{0},Value:{1}", property.Name, property.Value ) );
}
}
需要引用Microsoft.Build.BuildEngine.dll