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


C# BuildItemGroup.RemoveItem方法代码示例

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


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

示例1: TestRemoveItem2

		// NOTE: maybe it should throw an exception?
		// at the moment it probably doesn't find a "null" element
		public void TestRemoveItem2 ()
		{
			BuildItemGroup big = new BuildItemGroup ();

			big.RemoveItem (null);
		}
开发者ID:KonajuGames,项目名称:SharpLang,代码行数:8,代码来源:BuildItemGroupTest.cs

示例2: RemoveItemWhenItemIsNull

        public void RemoveItemWhenItemIsNull()
        {
            BuildItemGroup group = new BuildItemGroup();
            group.RemoveItem(null);

            Assertion.AssertEquals(0, group.Count);
        }
开发者ID:nikson,项目名称:msbuild,代码行数:7,代码来源:BuildItemGroup_Tests.cs

示例3: TestRemoveItem1

		public void TestRemoveItem1 ()
		{
			BuildItemGroup big = new BuildItemGroup ();

			big.AddNewItem ("a", "b");
			BuildItem b = big.AddNewItem ("b", "c");
			big.AddNewItem ("c", "d");

			big.RemoveItem (b);

			BuildItem[] items = big.ToArray ();
			Assert.AreEqual (2, big.Count, "A1");
			Assert.AreEqual ("a", items [0].Name, "A2");
			Assert.AreEqual ("c", items [1].Name, "A3");
		}
开发者ID:KonajuGames,项目名称:SharpLang,代码行数:15,代码来源:BuildItemGroupTest.cs

示例4: RemoveItemAllOfSeveral

        public void RemoveItemAllOfSeveral()
        {
            BuildItemGroup group = new BuildItemGroup();
            BuildItem[] item = new BuildItem[3];
            item[0] = group.AddNewItem("n1", "i1");
            item[1] = group.AddNewItem("n2", "i2");
            item[2] = group.AddNewItem("n3", "i3");

            group.RemoveItem(item[0]);
            group.RemoveItem(item[1]);
            group.RemoveItem(item[2]);

            Assertion.AssertEquals(0, group.Count);
        }
开发者ID:nikson,项目名称:msbuild,代码行数:14,代码来源:BuildItemGroup_Tests.cs

示例5: RemoveItemOneOfSeveral

        public void RemoveItemOneOfSeveral()
        {
            BuildItemGroup group = new BuildItemGroup();
            BuildItem item = group.AddNewItem("n1", "i1");
            group.AddNewItem("n2", "i2");
            group.AddNewItem("n3", "i3");

            group.RemoveItem(item);

            Assertion.AssertEquals(2, group.Count);

            Dictionary<string, string> items = GetDictionaryOfBuildItemsInBuildItemsGroup(group);
            Assertion.AssertEquals("i2", items["n2"]);
            Assertion.AssertEquals("i3", items["n3"]);
        }
开发者ID:nikson,项目名称:msbuild,代码行数:15,代码来源:BuildItemGroup_Tests.cs

示例6: Expander

        /// <summary>
        /// Processes the "include" list and the "exclude" list for an item element, and returns
        /// the resultant virtual group of items. Ignores any condition on the item.
        /// </summary>
        /// <param name="baseDirectory">Where relative paths should be evaluated from</param>
        /// <param name="originalItem">The "mother" item that's being expanded</param>
        /// <param name="expander">Expander to evaluated items and properties</param>
        /// <param name="expandMetadata">Whether metadata expressions should be expanded, or left as literals</param>
        internal static BuildItemGroup ExpandItemIntoItems
        (
            string baseDirectory,
            BuildItem originalItem,
            Expander expander,
            bool expandMetadata
        )
        {
            ErrorUtilities.VerifyThrow(originalItem != null, "Can't add a null item to project.");
            ErrorUtilities.VerifyThrow(expander != null, "expander can't be null.");

            // Take the entire string specified in the "Include" attribute, and split
            // it up by semi-colons.  Then loop over the individual pieces.
            // Expand only with properties first, so that expressions like Include="@(foo)" will transfer the metadata of the "foo" items as well, not just their item specs.
            List<string> itemIncludePieces = (new Expander(expander, ExpanderOptions.ExpandProperties).ExpandAllIntoStringListLeaveEscaped(originalItem.Include, originalItem.IncludeAttribute));
            BuildItemGroup itemsToInclude = new BuildItemGroup();
            for (int i = 0; i < itemIncludePieces.Count; i++)
            {
                BuildItemGroup itemizedGroup = expander.ExpandSingleItemListExpressionIntoItemsLeaveEscaped(itemIncludePieces[i], originalItem.IncludeAttribute);
                if (itemizedGroup == null)
                {
                    // The expression did not represent a single @(...) item list reference. 
                    if (expandMetadata)
                    {
                        // We're inside a target: metadata expressions like %(foo) are legal, so expand them now
                        itemIncludePieces[i] = expander.ExpandMetadataLeaveEscaped(itemIncludePieces[i]);
                    }
                    // Now it's a string constant, possibly with wildcards.
                    // Take each individual path or file expression, and expand any
                    // wildcards.  Then loop through each file returned.
                    if (itemIncludePieces[i].Length > 0)
                    {
                        string[] includeFileList = EngineFileUtilities.GetFileListEscaped(baseDirectory, itemIncludePieces[i]);
                        for (int j = 0; j < includeFileList.Length; j++)
                        {
                            BuildItem newItem = itemsToInclude.AddNewItem(originalItem.Name, originalItem.Include);
                            newItem.SetEvaluatedItemSpecEscaped(itemIncludePieces[i]);   // comes from XML include --- "arbitrarily escaped"
                            newItem.SetFinalItemSpecEscaped(includeFileList[j]);  // comes from file system matcher -- "canonically escaped"
                        }
                    }
                }
                else
                {
                    itemsToInclude.ImportItems(itemizedGroup);
                }
            }

            List<BuildItem> matchingItems = FindItemsMatchingSpecification(itemsToInclude, originalItem.Exclude, originalItem.ExcludeAttribute, expander, baseDirectory);

            if (matchingItems != null)
            {
                foreach (BuildItem item in matchingItems)
                {
                    itemsToInclude.RemoveItem(item);
                }
            }
            
            return itemsToInclude;
        }
开发者ID:nikson,项目名称:msbuild,代码行数:67,代码来源:BuildItemGroup.cs

示例7: RemoveItemNotBelonging

        public void RemoveItemNotBelonging()
        {
            XmlElement ig = CreatePersistedItemGroupElement();
            BuildItemGroup group = new BuildItemGroup(ig, false, new Project());

            BuildItem item = new BuildItem("x", "x1");
            group.RemoveItem(item);
        }
开发者ID:nikson,项目名称:msbuild,代码行数:8,代码来源:BuildItemGroup_Tests.cs

示例8: RemoveItem1

        public void RemoveItem1()
        {
            XmlElement ig = CreatePersistedItemGroupElement();
            BuildItemGroup group = new BuildItemGroup(ig, false, new Project());

            BuildItem i2 = group[1];
            group.RemoveItem(i2);

            Assertion.AssertEquals(1, group.Count);
            Assertion.AssertEquals(1, group.ItemGroupElement.ChildNodes.Count);
            Assertion.AssertEquals("i1", group[0].Include);
            Assertion.AssertEquals(null, i2.ParentPersistedItemGroup);
        }
开发者ID:nikson,项目名称:msbuild,代码行数:13,代码来源:BuildItemGroup_Tests.cs


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