您的位置:首页 > 其它

读取VS2008项目文件

2011-11-07 16:12 363 查看
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
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  string 文档