当前位置: 首页>>代码示例>>C#>>正文


C# BuildItemGroup.RemoveItems方法代码示例

本文整理汇总了C#中Microsoft.Build.BuildEngine.BuildItemGroup.RemoveItems方法的典型用法代码示例。如果您正苦于以下问题:C# BuildItemGroup.RemoveItems方法的具体用法?C# BuildItemGroup.RemoveItems怎么用?C# BuildItemGroup.RemoveItems使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Microsoft.Build.BuildEngine.BuildItemGroup的用法示例。


在下文中一共展示了BuildItemGroup.RemoveItems方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GetItems


//.........这里部分代码省略.........
                    {
                        allAdds = CreateItemGroupIfNecessary(allAdds);
                        allAdds.ImportItems(adds);
                    }
                }

                // Accumulate removes while we look downwards
                if (entry.Removes != null)
                {
                    BuildItemGroup removes = (BuildItemGroup)entry.Removes[name];
                    if (removes != null)
                    {
                        allRemoves = CreateItemGroupIfNecessary(allRemoves);
                        allRemoves.ImportItems(removes);
                    }
                }

                // Accumulate modifications as we look downwards
                if (entry.Modifies != null)
                {
                    Dictionary<BuildItem, Dictionary<string, string>> modifies;
                    if (entry.Modifies.TryGetValue(name, out modifies))
                    {
                        if (allModifies == null)
                        {
                            allModifies = new Dictionary<BuildItem, Dictionary<string, string>>();
                        }

                        // We already have some modifies for this type
                        foreach (KeyValuePair<BuildItem, Dictionary<string, string>> modify in modifies)
                        {
                            // If earlier scopes modify the same metadata on the same item,
                            // they have priority
                            MergeModificationsIntoModificationTable(allModifies, modify, ModifyMergeType.FirstWins);
                        }
                    }
                }

                if (entry.Items != null)
                {
                    groupFound = (BuildItemGroup)entry.Items[name];
                    if (groupFound != null)
                    {
                        // Found a group: we go no further
                        break;
                    }
                }

                if (entry.TruncateLookupsAtThisScope)
                {
                    break;
                }
            }

            if ((allAdds == null || allAdds.Count == 0) &&
                (allRemoves == null || allRemoves.Count == 0) &&
                (allModifies == null || allModifies.Count == 0))
            {
                // We can just hand out this group verbatim -
                // that avoids any importing
                if (groupFound == null)
                {
                    groupFound = new BuildItemGroup();
                }

                return groupFound;
            }

            // We have adds and/or removes and/or modifies to incorporate.
            // We can't modify the group, because that might
            // be visible to other batches; we have to create
            // a new one.
            BuildItemGroup result = new BuildItemGroup();

            if (groupFound != null)
            {
                result.ImportItems(groupFound);
            }
            // Removes are processed after adds; this means when we remove there's no need to concern ourselves
            // with the case where the item being removed is in an add table somewhere. The converse case is not possible
            // using a project file: a project file cannot create an item that was already removed, it can only create
            // a unique new item.
            if (allAdds != null)
            {
                result.ImportItems(allAdds);
            }

            if (allRemoves != null)
            {
                result.RemoveItems(allRemoves);
            }

            // Modifies can be processed last; if a modified item was removed, the modify will be ignored
            if (allModifies != null)
            {
                ApplyModifies(result, allModifies);
            }

            return result;
        }
开发者ID:nikson,项目名称:msbuild,代码行数:101,代码来源:Lookup.cs


注:本文中的Microsoft.Build.BuildEngine.BuildItemGroup.RemoveItems方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。