本文整理匯總了C#中Microsoft.Build.BuildEngine.BuildPropertyGroup.GetEnumerator方法的典型用法代碼示例。如果您正苦於以下問題:C# BuildPropertyGroup.GetEnumerator方法的具體用法?C# BuildPropertyGroup.GetEnumerator怎麽用?C# BuildPropertyGroup.GetEnumerator使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Microsoft.Build.BuildEngine.BuildPropertyGroup
的用法示例。
在下文中一共展示了BuildPropertyGroup.GetEnumerator方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: Main
//引入命名空間
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 the 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);
}
}
}
}
}