public override bool Execute() { Result = ItemGroup1.Select(ig => ig.ItemSpec).Intersect(ItemGroup2.Select(ig => ig.ItemSpec)).Any(); Log.LogMessage("GetDoItemsIntersect completed successfully - returned {0}", Result.ToString()); return(true); }
protected override void ExecuteCore() { var packageRanks = new PackageRank(PreferredPackages); var packageOverrides = new PackageOverrideResolver <ConflictItem>(PackageOverrides); var conflicts = new HashSet <ConflictItem>(); var conflictItemGroup1 = GetConflictTaskItems(ItemGroup1, ConflictItemType.CopyLocal); var conflictItemGroup2 = GetConflictTaskItems(ItemGroup2, ConflictItemType.CopyLocal); using (var conflictResolver = new ConflictResolver <ConflictItem>(packageRanks, packageOverrides, Log)) { var allConflicts = conflictItemGroup1.Concat(conflictItemGroup2); conflictResolver.ResolveConflicts(allConflicts, ci => ItemUtilities.GetReferenceTargetPath(ci.OriginalItem), (ConflictItem winner, ConflictItem loser) => { conflicts.Add(loser); }); var conflictItems = conflicts.Select(i => i.OriginalItem); RemovedItemGroup1 = ItemGroup1.Intersect(conflictItems).ToArray(); RemovedItemGroup2 = ItemGroup2.Intersect(conflictItems).ToArray(); } }