本文整理汇总了C#中Microsoft.Build.BuildEngine.Project.PropertyGroups属性的典型用法代码示例。如果您正苦于以下问题:C# Project.PropertyGroups属性的具体用法?C# Project.PropertyGroups怎么用?C# Project.PropertyGroups使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。
在下文中一共展示了Project.PropertyGroups属性的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);
}
}
}
}
}