本文整理汇总了C#中Microsoft.Build.BuildEngine.GetEvaluatedItemsByName方法的典型用法代码示例。如果您正苦于以下问题:C# Microsoft.Build.BuildEngine.GetEvaluatedItemsByName方法的具体用法?C# Microsoft.Build.BuildEngine.GetEvaluatedItemsByName怎么用?C# Microsoft.Build.BuildEngine.GetEvaluatedItemsByName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Microsoft.Build.BuildEngine
的用法示例。
在下文中一共展示了Microsoft.Build.BuildEngine.GetEvaluatedItemsByName方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: LoadReferencesFromBuildProject
/// <summary>
/// Adds references to this container from a MSBuild project.
/// </summary>
public void LoadReferencesFromBuildProject(MSBuild.Project buildProject)
{
foreach (string referenceType in SupportedReferenceTypes)
{
MSBuild.BuildItemGroup refererncesGroup = buildProject.GetEvaluatedItemsByName(referenceType);
bool isAssemblyReference = referenceType == ProjectFileConstants.Reference;
// If the project was loaded for browsing we should still create the nodes but as not resolved.
if (this.ProjectMgr.HasPassedSecurityChecks && isAssemblyReference && this.ProjectMgr.Build(MsBuildTarget.ResolveAssemblyReferences) != MSBuildResult.Successful)
{
continue;
}
foreach (MSBuild.BuildItem item in refererncesGroup)
{
ProjectElement element = new ProjectElement(this.ProjectMgr, item, false);
ReferenceNode node = CreateReferenceNode(referenceType, element);
if (node != null)
{
// Make sure that we do not want to add the item twice to the ui hierarchy
// We are using here the UI representation of the Node namely the Caption to find that out, in order to
// avoid different representation problems.
// Example :<Reference Include="EnvDTE80, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
// <Reference Include="EnvDTE80" />
bool found = false;
for (HierarchyNode n = this.FirstChild; n != null && !found; n = n.NextSibling)
{
if (String.Compare(n.Caption, node.Caption, StringComparison.OrdinalIgnoreCase) == 0)
{
found = true;
}
}
if (!found)
{
this.AddChild(node);
}
}
}
}
}