/// <summary> /// Verify item is not in the table /// </summary> private void MustNotBeInTable(Hashtable table, BuildItem item) { BuildItemGroup group = new BuildItemGroup(); group.AddItem(item); MustNotBeInTable(table, item.Name, group); }
/// <summary> /// Removes all Items of a given typoe from the collection. /// Recurses into Chooses in the collection removing Items as well. /// </summary> /// <remarks> /// </remarks> /// <owner>DavidLe</owner> /// <param name="itemName"></param> internal void RemoveItemsByName(string itemName) { BuildItemGroup itemsToRemove = new BuildItemGroup(); foreach (BuildItemGroup itemGroup in this.ItemGroupsAll) { // Now loop through the Items in the BuildItemGroup, and keep track of the // ones that are of the requested item type. foreach (BuildItem item in itemGroup) { if ((0 == String.Compare(item.Name, itemName, StringComparison.OrdinalIgnoreCase)) && !item.IsImported ) { // We're not allowed to remove an item from a collection while // the collection is being enumerated. So we have to track it // in a separate list. itemsToRemove.AddItem(item); } } } foreach (BuildItem itemToRemove in itemsToRemove) { itemToRemove.ParentPersistedItemGroup.ParentProject.RemoveItem(itemToRemove); } }