本文整理汇总了C#中Microsoft.Build.Execution.ProjectInstance.Select方法的典型用法代码示例。如果您正苦于以下问题:C# ProjectInstance.Select方法的具体用法?C# ProjectInstance.Select怎么用?C# ProjectInstance.Select使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Microsoft.Build.Execution.ProjectInstance
的用法示例。
在下文中一共展示了ProjectInstance.Select方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: getDependencies
/// Returns all the dependencies of a number of projects.
static ProjectInstance[] getDependencies(ProjectInstance[] allInstances, ProjectInstance[] roots)
{
var allGuids = allInstances.ToDictionary(getProjectGuid);
var todo = new Queue<Guid>(roots.Select(getProjectGuid));
var rootSet = new HashSet<Guid>(roots.Select(getProjectGuid));
var dependencies = new HashSet<Guid>();
while (todo.Count != 0)
{
var next = todo.Dequeue();
getDependentProjectGuids(allGuids[next])
.Where(g => !dependencies.Contains(g) && !rootSet.Contains(g) && allGuids.ContainsKey(g))
.ForEach(g =>
{
todo.Enqueue(g);
dependencies.Add(g);
});
}
return dependencies.Select(g => allGuids[g]).ToArray();
}
示例2: getAffectedProjects
/// Returns all the affected projects of the given list of projects.
/// Since the roots may refer to each other, the roots are included in the result set.
static ProjectInstance[] getAffectedProjects(ProjectInstance[] allInstances, ProjectInstance[] roots)
{
var dependentMap = createDependentMap(allInstances);
var allGuids = allInstances.ToDictionary(getProjectGuid);
var rootGuids = roots.Select(getProjectGuid).ToArray();
var todo = new Queue<Guid>(rootGuids);
var affected = new HashSet<Guid>(rootGuids);
while (todo.Count != 0)
{
var next = todo.Dequeue();
HashSet<Guid> dependents = null;
if (!dependentMap.TryGetValue(next, out dependents))
continue;
dependents.ForEach(dep => {
if (affected.Add(dep))
todo.Enqueue(dep); }
);
}
return affected.Select(g => allGuids[g]).ToArray();
}
示例3: printSummary
void printSummary(SummaryLogger logger, ProjectInstance[] allProjects)
{
var results = logger.ProjectResults;
var filenamesOfProjects = new HashSet<string>(allProjects.Select(pi => pi.FullPath));
// we must group by filename and not by project id, it seems that we get multiple results with different project ids for the same project.
// and even that list may include projects that we did not actually build explicitly.
var projectResults =
results
.GroupBy(result => result.Filename)
.Select(rs => rs.Last())
.Where(rs => filenamesOfProjects.Contains(rs.Filename))
.ToArray();
var succeded = projectResults.Count(result => result.Succeeded);
var failed = projectResults.Count(result => !result.Succeeded);
coreToIDE(() => _pane.OutputString($"========== BuildOnSave: {succeded} succeeded, {failed} failed ==========\n"));
}