本文整理汇总了C#中Microsoft.Build.Execution.BuildResult.HasResultsForTarget方法的典型用法代码示例。如果您正苦于以下问题:C# BuildResult.HasResultsForTarget方法的具体用法?C# BuildResult.HasResultsForTarget怎么用?C# BuildResult.HasResultsForTarget使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Microsoft.Build.Execution.BuildResult
的用法示例。
在下文中一共展示了BuildResult.HasResultsForTarget方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TestHasResultsForTarget
public void TestHasResultsForTarget()
{
BuildRequest request = CreateNewBuildRequest(1, new string[0]);
BuildResult result = new BuildResult(request);
result.AddResultsForTarget("foo", TestUtilities.GetEmptySucceedingTargetResult());
Assert.IsTrue(result.HasResultsForTarget("foo"));
Assert.IsFalse(result.HasResultsForTarget("bar"));
}
示例2: AreResultsIdenticalForTarget
static private bool AreResultsIdenticalForTarget(BuildResult a, BuildResult b, string target)
{
if (!a.HasResultsForTarget(target) || !b.HasResultsForTarget(target))
{
return false;
}
if (a[target].ResultCode != b[target].ResultCode)
{
return false;
}
if (!AreItemsIdentical(a[target].Items, b[target].Items))
{
return false;
}
return true;
}
示例3: CheckResults
/// <summary>
/// Looks for results for the specified targets.
/// </summary>
/// <param name="result">The result to examine</param>
/// <param name="targets">The targets to search for</param>
/// <param name="targetClass">The class of targets</param>
/// <param name="targetsMissingResults">An optional list to be populated with missing targets</param>
/// <param name="skippedResultsAreOK">If true, a status of "skipped" counts as having valid results
/// for that target. Otherwise, a skipped target is treated as equivalent to a missing target.</param>
/// <returns>False if there were missing results, true otherwise.</returns>
private bool CheckResults(BuildResult result, List<string> targets, TargetClass targetClass, HashSet<string> targetsMissingResults, bool skippedResultsAreOK)
{
bool returnValue = true;
foreach (string target in targets)
{
if (!result.HasResultsForTarget(target) || (result[target].ResultCode == TargetResultCode.Skipped && !skippedResultsAreOK))
{
if (null != targetsMissingResults)
{
targetsMissingResults.Add(target);
returnValue = false;
}
else
{
return false;
}
}
else
{
// If the result was a failure and we have not seen any skipped targets up to this point, then we conclude we do
// have results for this request, and they indicate failure.
if (result[target].ResultCode == TargetResultCode.Failure && (targetsMissingResults == null || targetsMissingResults.Count == 0))
{
return true;
}
}
}
return returnValue;
}