1 type derived from ProjectItem
Microsoft.Build (1)
ObjectModelRemoting\LinkedObjectFactory.cs (1)
241private class LinkedProjectItem : ProjectItem, ILinkableObject, IImmutableInstanceProvider<ProjectItemInstance>
2 instantiations of ProjectItem
Microsoft.Build (2)
Definition\ProjectItem.cs (2)
1022return new ProjectItem(_project, _xml, evaluatedIncludeEscaped, evaluatedIncludeBeforeWildcardExpansion, null /* no metadata */, null /* no inherited definition metadata */); 1086return new ProjectItem(_project, _xml, evaluatedIncludeEscaped, evaluatedIncludeBeforeWildcardExpansionEscaped, directMetadataClone, inheritedItemDefinitionsClone);
517 references to ProjectItem
dotnet-openapi (3)
Commands\RefreshCommand.cs (1)
44foreach (ProjectItem item in openApiReferenceItems)
Commands\RemoveCommand.cs (1)
56foreach (ProjectItem item in openApiReferenceItems)
ProjectExtensions.cs (1)
14var item = project.AddItem(tagName, include).Single();
Microsoft.Build (176)
Construction\Solution\SolutionProjectGenerator.cs (3)
23using ProjectItem = Microsoft.Build.Evaluation.ProjectItem; 2153IEnumerable<ProjectItem> references = msbuildProject.GetItems("ProjectDependency"); 2155foreach (ProjectItem reference in references)
Definition\Project.cs (99)
27using EvaluationItemExpressionFragment = Microsoft.Build.Evaluation.ItemSpec<Microsoft.Build.Evaluation.ProjectProperty, Microsoft.Build.Evaluation.ProjectItem>.ItemExpressionFragment; 28using EvaluationItemSpec = Microsoft.Build.Evaluation.ItemSpec<Microsoft.Build.Evaluation.ProjectProperty, Microsoft.Build.Evaluation.ProjectItem>; 33using ProjectItemFactory = Microsoft.Build.Evaluation.ProjectItem.ProjectItemFactory; 92/// - <see cref="ProjectItem.ChangeItemType"/> 93/// - <see cref="ProjectItem.Rename"/> 94/// - <see cref="ProjectItem.RemoveMetadata"/> 95/// - <see cref="ProjectItem.SetMetadataValue(string,string)"/> 96/// - <see cref="ProjectItem.SetMetadataValue(string,string, bool)"/> 665public ICollection<ProjectItem> Items => implementation.Items; 675public ICollection<ProjectItem> ItemsIgnoringCondition => implementation.ItemsIgnoringCondition; 728public ICollection<ProjectItem> AllEvaluatedItems => implementation.AllEvaluatedItems; 851public static string GetEvaluatedItemIncludeEscaped(ProjectItem item) 1053public List<ProvenanceResult> GetItemProvenance(ProjectItem item) 1059/// See <see cref="GetItemProvenance(ProjectItem)"/>. 1070public List<ProvenanceResult> GetItemProvenance(ProjectItem item, EvaluationContext evaluationContext) 1089public static string GetMetadataValueEscaped(ProjectItem item, string name) 1190public IList<ProjectItem> AddItem(string itemType, string unevaluatedInclude) 1204public IList<ProjectItem> AddItem(string itemType, string unevaluatedInclude, IEnumerable<KeyValuePair<string, string>> metadata) 1219public IList<ProjectItem> AddItemFast(string itemType, string unevaluatedInclude) 1235public IList<ProjectItem> AddItemFast(string itemType, string unevaluatedInclude, IEnumerable<KeyValuePair<string, string>> metadata) 1249public ICollection<ProjectItem> GetItems(string itemType) 1262public ICollection<ProjectItem> GetItemsIgnoringCondition(string itemType) 1278public ICollection<ProjectItem> GetItemsByEvaluatedInclude(string evaluatedInclude) 1323public bool RemoveItem(ProjectItem item) 1338public void RemoveItems(IEnumerable<ProjectItem> items) 1679var relevantItems = new List<ProjectItem>(); 1681foreach (ProjectItem item in Items) 1689foreach (ProjectItem item in relevantItems) 1713/// Outside this class called ONLY from <see cref="ProjectItem.Rename(string)"/>ProjectItem.Rename(string name). 1725internal void RemoveItemBeforeItemTypeChange(ProjectItem item) 1735internal void ReAddExistingItemAfterItemTypeChange(ProjectItem item) 1984/// - <see cref="ProjectItem.Rename"/> 1985/// - <see cref="ProjectItem.RemoveMetadata"/> 1986/// - <see cref="ProjectItem.SetMetadataValue(string,string)"/> 1987/// - <see cref="ProjectItem.SetMetadataValue(string,string, bool)"/> 2218public override ICollection<ProjectItem> Items => new ReadOnlyCollection<ProjectItem>(_data.Items); 2228public override ICollection<ProjectItem> ItemsIgnoringCondition 2238return new ReadOnlyCollection<ProjectItem>(_data.ItemsIgnoringCondition); 2365public override ICollection<ProjectItem> AllEvaluatedItems 2369ICollection<ProjectItem> allEvaluatedItems = _data.AllEvaluatedItems; 2373return ReadOnlyEmptyCollection<ProjectItem>.Instance; 2376return new ReadOnlyCollection<ProjectItem>(allEvaluatedItems); 2708/// See <see cref="ProjectLink.GetItemProvenance(ProjectItem, EvaluationContext)"/>. 2719public override List<ProvenanceResult> GetItemProvenance(ProjectItem item, EvaluationContext evaluationContext) 2750private static IEnumerable<ProjectItemElement> GetItemElementsThatMightAffectItem(List<ProjectItemElement> evaluatedItemElements, ProjectItem item) 3004public override IList<ProjectItem> AddItem(string itemType, string unevaluatedInclude, IEnumerable<KeyValuePair<string, string>> metadata) 3053public override IList<ProjectItem> AddItemFast(string itemType, string unevaluatedInclude, IEnumerable<KeyValuePair<string, string>> metadata) 3106public override ICollection<ProjectItem> GetItems(string itemType) 3108ICollection<ProjectItem> items = _data.GetItems(itemType); 3120public override ICollection<ProjectItem> GetItemsIgnoringCondition(string itemType) 3122ICollection<ProjectItem> items = _data.ItemsIgnoringCondition[itemType]; 3137public override ICollection<ProjectItem> GetItemsByEvaluatedInclude(string evaluatedInclude) 3139ICollection<ProjectItem> items = _data.GetItemsByEvaluatedInclude(evaluatedInclude); 3215public override bool RemoveItem(ProjectItem item) 3235public override void RemoveItems(IEnumerable<ProjectItem> items) 3243var itemsList = new List<ProjectItem>(items); 3245foreach (ProjectItem item in itemsList) 3400var relevantItems = new List<ProjectItem>(); 3402foreach (ProjectItem item in Items) 3410foreach (ProjectItem item in relevantItems) 3434/// Outside this class called ONLY from <see cref="ProjectItem.Rename(string)"/>ProjectItem.Rename(string name). 3478public void RemoveItemBeforeItemTypeChange(ProjectItem item) 3488public void ReAddExistingItemAfterItemTypeChange(ProjectItem item) 3528List<ProjectItem> items = Evaluator<ProjectProperty, ProjectItem, ProjectMetadata, ProjectItemDefinition>.CreateItemsFromInclude( 3591private List<ProjectItem> AddItemHelper(ProjectItemElement itemElement, string unevaluatedInclude, IEnumerable<KeyValuePair<string, string>> metadata) 3595List<ProjectItem> items = Evaluator<ProjectProperty, ProjectItem, ProjectMetadata, ProjectItemDefinition>.CreateItemsFromInclude( 3605foreach (ProjectItem item in items) 3613foreach (ProjectItem item in items) 3634private bool RemoveItemHelper(ProjectItem item) 3717Evaluator<ProjectProperty, ProjectItem, ProjectMetadata, ProjectItemDefinition>.Evaluate( 3966void RemoveItemBeforeItemTypeChange(ProjectItem item); 3968void ReAddExistingItemAfterItemTypeChange(ProjectItem item); 3991public void RemoveItemBeforeItemTypeChange(ProjectItem item) { throw new NotImplementedException(); } 3993public void ReAddExistingItemAfterItemTypeChange(ProjectItem item) { throw new NotImplementedException(); } 4009internal class Data : IItemProvider<ProjectItem>, IPropertyProvider<ProjectProperty>, IEvaluatorData<ProjectProperty, ProjectItem, ProjectMetadata, ProjectItemDefinition> 4047IEnumerable<ProjectItemDefinition> IEvaluatorData<ProjectProperty, ProjectItem, ProjectMetadata, ProjectItemDefinition>.ItemDefinitionsEnumerable => ItemDefinitions.Values; 4120public IItemDictionary<ProjectItem> Items { get; private set; } 4130public ItemDictionary<ProjectItem> ItemsIgnoringCondition { get; private set; } 4204internal IList<ProjectItem> AllEvaluatedItems { get; private set; } 4211internal Expander<ProjectProperty, ProjectItem> Expander { get; private set; } 4259internal MultiDictionary<string, ProjectItem> ItemsByEvaluatedIncludeCache { get; private set; } 4269Items = new ItemDictionary<ProjectItem>(); 4270ItemsIgnoringCondition = new ItemDictionary<ProjectItem>(); 4271ItemsByEvaluatedIncludeCache = new MultiDictionary<string, ProjectItem>(StringComparer.OrdinalIgnoreCase); 4272Expander = new Expander<ProjectProperty, ProjectItem>(Properties, Items, evaluationContext, loggingContext); 4279AllEvaluatedItems = new List<ProjectItem>(); 4366public void AddItem(ProjectItem item) 4375public void AddItemIgnoringCondition(ProjectItem item) 4410public void AddToAllEvaluatedItemsList(ProjectItem item) 4514string IEvaluatorData<ProjectProperty, ProjectItem, ProjectMetadata, ProjectItemDefinition>.ExpandString(string unexpandedValue) 4547public ICollection<ProjectItem> GetItems(string itemType) 4581internal bool RemoveItem(ProjectItem item) 4605internal ICollection<ProjectItem> GetItemsByEvaluatedInclude(string evaluatedInclude) 4608ICollection<ProjectItem> items = new ReadOnlyCollection<ProjectItem>(ItemsByEvaluatedIncludeCache[evaluatedInclude]);
Definition\ProjectItem.cs (18)
503if (metadatum != null && Expander<ProjectProperty, ProjectItem>.ExpressionMayContainExpandableExpressions(metadatum.EvaluatedValueEscaped)) 505Expander<ProjectProperty, ProjectItem> expander = new Expander<ProjectProperty, ProjectItem>(null, null, new BuiltInMetadataTable(this), FileSystems.Default); 572/// If true, adds direct metadata to the <see cref="ProjectItemElement"/> from which this <see cref="ProjectItem"/> originated. The intent is to affect all other sibling items. 620foreach (var siblingItem in siblingItems) 906internal class ProjectItemFactory : IItemFactory<ProjectItem, ProjectItem> 968public ProjectItem CreateItem(string include, string definingProject) 985public ProjectItem CreateItem(ProjectItem source, string definingProject) 1005public ProjectItem CreateItem(string evaluatedIncludeEscaped, ProjectItem source, string definingProject) 1018public ProjectItem CreateItem(string evaluatedIncludeEscaped, string evaluatedIncludeBeforeWildcardExpansion, string definingProject) 1028public void SetMetadata(IEnumerable<KeyValuePair<ProjectMetadataElement, string>> metadata, IEnumerable<ProjectItem> destinationItems) 1042private ProjectItem CreateItem(string evaluatedIncludeEscaped, string evaluatedIncludeBeforeWildcardExpansionEscaped, ProjectItem source) 1099private ProjectItem _item; 1104internal BuiltInMetadataTable(ProjectItem item)
Evaluation\ProjectParser.cs (1)
10using Expander = Microsoft.Build.Evaluation.Expander<Microsoft.Build.Evaluation.ProjectProperty, Microsoft.Build.Evaluation.ProjectItem>;
Instance\ProjectInstance.cs (20)
406foreach (var item in project.Items) 450_itemsByEvaluatedInclude = new ImmutableLinkedMultiDictionaryConverter<string, ProjectItem, ProjectItemInstance>( 482foreach (var item in linkedProject.Items) 659var projectItemToInstanceMap = this.CreateItemsSnapshot(new ReadOnlyCollection<ProjectItem>(data.Items), data.ItemTypes.Count, keepEvaluationCache); 661this.CreateEvaluatedIncludeSnapshotIfRequested(keepEvaluationCache, new ReadOnlyCollection<ProjectItem>(data.Items), projectItemToInstanceMap); 919private static ImmutableItemDictionary<ProjectItem, ProjectItemInstance> GetImmutableItemsDictionaryFromImmutableProject( 923var itemsByType = linkedProject.Items as IDictionary<string, ICollection<ProjectItem>>; 929Func<ProjectItem, ProjectItemInstance> convertCachedItemToInstance = 932var itemDictionary = new ImmutableItemDictionary<ProjectItem, ProjectItemInstance>( 944ProjectItem projectItem) 3289private void CreateEvaluatedIncludeSnapshotIfRequested(bool keepEvaluationCache, ICollection<ProjectItem> items, Dictionary<ProjectItem, ProjectItemInstance> projectItemToInstanceMap) 3297foreach (var item in items) 3308private Dictionary<ProjectItem, ProjectItemInstance> CreateItemsSnapshot(ICollection<ProjectItem> items, int itemTypeCount, bool keepEvaluationCache) 3312var projectItemToInstanceMap = keepEvaluationCache ? new Dictionary<ProjectItem, ProjectItemInstance>(items.Count) : null; 3314foreach (ProjectItem item in items) 3324private ProjectItemInstance InstantiateProjectItemInstance(ProjectItem item) 3367ProjectItem item, 3381ProjectItem item)
Instance\ProjectItemInstance.cs (4)
1335if (metadatum != null && Expander<ProjectProperty, ProjectItem>.ExpressionMayContainExpandableExpressions(metadatum.EvaluatedValueEscaped)) 2110internal class TaskItemFactory : IItemFactory<ProjectItem, TaskItem>, IItemFactory<ProjectItemInstance, TaskItem> 2164public TaskItem CreateItem(ProjectItem source, string definingProject) 2174public TaskItem CreateItem(string includeEscaped, ProjectItem baseItem, string definingProject)
Logging\BinaryLogger\BuildEventArgsWriter.cs (1)
969else if (items is ItemDictionary<ProjectItem> itemDictionary)
ObjectModelRemoting\DefinitionObjectsLinks\ProjectItemLink.cs (14)
14/// Allow for creating a local representation to external object of type <see cref="ProjectItem"/> 19/// Access to remote <see cref="ProjectItem.Project"/>. 24/// Access to remote <see cref="ProjectItem.Xml"/>. 29/// Access to remote <see cref="ProjectItem.EvaluatedInclude"/>. 34/// Facilitate remoting the <see cref="ProjectItem.Metadata"/> and <see cref="ProjectItem.MetadataCount"/>. 39/// Facilitate remoting the <see cref="ProjectItem.DirectMetadata"/> and <see cref="ProjectItem.DirectMetadataCount"/>. 44/// Facilitate remoting the <see cref="ProjectItem.HasMetadata"/>. 49/// Facilitate remoting the <see cref="ProjectItem.GetMetadata"/>. 54/// Facilitate remoting the <see cref="ProjectItem.GetMetadataValue"/>. 59/// Facilitate remoting the <see cref="ProjectItem.SetMetadataValue(string, string, bool)"/>. 64/// Facilitate remoting the <see cref="ProjectItem.RemoveMetadata"/>. 69/// Facilitate remoting the <see cref="ProjectItem.Rename"/>.
ObjectModelRemoting\DefinitionObjectsLinks\ProjectLink.cs (12)
66public abstract ICollection<ProjectItem> Items { get; } 71public abstract ICollection<ProjectItem> ItemsIgnoringCondition { get; } 101public abstract ICollection<ProjectItem> AllEvaluatedItems { get; } 154/// Facilitate remoting the <see cref="Project.GetItemProvenance(ProjectItem, EvaluationContext)"/>. 156public abstract List<ProvenanceResult> GetItemProvenance(ProjectItem item, EvaluationContext evaluationContext); 186public abstract IList<ProjectItem> AddItem(string itemType, string unevaluatedInclude, IEnumerable<KeyValuePair<string, string>> metadata); 191public abstract IList<ProjectItem> AddItemFast(string itemType, string unevaluatedInclude, IEnumerable<KeyValuePair<string, string>> metadata); 196public abstract ICollection<ProjectItem> GetItems(string itemType); 201public abstract ICollection<ProjectItem> GetItemsIgnoringCondition(string itemType); 206public abstract ICollection<ProjectItem> GetItemsByEvaluatedInclude(string evaluatedInclude); 221public abstract bool RemoveItem(ProjectItem item); 226public abstract void RemoveItems(IEnumerable<ProjectItem> items);
ObjectModelRemoting\DefinitionObjectsLinks\ProjectMetadataLink.cs (1)
19/// Can be either <see cref="ProjectItem"/>, or <see cref="ProjectItemDefinition"/>
ObjectModelRemoting\LinkedObjectFactory.cs (1)
80public ProjectItem Create(ProjectItemLink link, Project project = null, ProjectItemElement xml = null)
Utilities\Utilities.cs (2)
723else if (items is ItemDictionary<ProjectItem> projectItemDictionary) 753else if (items is ItemDictionary<ProjectItem> projectItemDictionary)
Microsoft.Build.Engine.OM.UnitTests (275)
Construction\ConstructionEditing_Tests.cs (1)
2325ProjectItem item = Helpers.GetFirst(project.Items);
Construction\ProjectFormatting_Tests.cs (2)
286var itemToRemove = project.GetItems("Compile").Single(item => item.EvaluatedInclude == "Class2.cs"); 325var itemToEdit = project.GetItems("Compile").Single(item => item.EvaluatedInclude == "Class2.cs");
Construction\ProjectItemElement_Tests.cs (3)
958ProjectItem item = project.AddItem("i", "i1")[0]; 974ProjectItem item = project.AddItem("i", "i1")[0]; 990ProjectItem item = project.AddItem("i", "i1")[0];
Definition\DefinitionEditing_Tests.cs (39)
163List<ProjectItem> items = Helpers.MakeList(project.Items); 190List<ProjectItem> items = Helpers.MakeList(project.Items); 292List<ProjectItem> items = Helpers.MakeList(project.Items); 316ProjectItem item = project.AddItem("i", "@(h)")[0]; 329IList<ProjectItem> items = project.AddItem( 861ProjectItem item = Helpers.GetLast(project.Items); 888ProjectItem item = Helpers.GetFirst(project.Items); 916ProjectItem item = Helpers.GetLast(project.Items); 944ProjectItem item = Helpers.GetLast(project.Items); 974ProjectItem item = Helpers.GetLast(project.Items); 1002ProjectItem item = Helpers.GetFirst(project.GetItems("i")); 1034ProjectItem item = Helpers.MakeList(project.GetItems("i"))[1]; 1063ProjectItem item = Helpers.MakeList(project.GetItems("i"))[1]; 1102ProjectItem item = Helpers.GetFirst(project.Items); 1144ProjectItem item = Helpers.GetFirst(project.Items); 1174ProjectItem item = Helpers.GetFirst(project.GetItems("i")); 1210ProjectItem item0 = project.AddItem("i", "i1")[0]; 1218ProjectItem item = Helpers.GetFirst(project.GetItems("i")); 1269ProjectItem item = Helpers.GetFirst(project.GetItems("i")); 1398ProjectItem item = Helpers.GetFirst(project.Items); 1438List<ProjectItem> itemsIgnoringCondition = Helpers.MakeList(project.GetItemsIgnoringCondition("i")); 1440ProjectItem item = itemsIgnoringCondition[0]; 1637var item = project.AddItem("i", "i1")[0]; 1652var item = project.AddItem("i", "i1")[0]; 1867ProjectItem item = project.AddItem("i", "i1")[0]; 1882List<ProjectItem> items = Helpers.MakeList(project.Items); 1895ProjectItem item = project.AddItem("i", "i1")[0]; 1910List<ProjectItem> items = Helpers.MakeList(project.Items); 1924ProjectItem item = project.AddItem("i", "i1")[0]; 1940List<ProjectItem> items = Helpers.MakeList(project.Items); 1953IList<ProjectItem> items = project.AddItem("i", "a;b"); 2011ProjectItem item = Helpers.GetFirst(project.Items); 2087List<ProjectItem> items = Helpers.MakeList(project.Items); 2114List<ProjectItem> items = Helpers.MakeList(project.Items); 2216List<ProjectItem> items = Helpers.MakeList(project.Items); 2240ProjectItem item = project.AddItemFast("i", "@(h)")[0]; 2253IList<ProjectItem> items = project.AddItemFast("i", 2574private static void AssertDisabledItemSplitting(string projectContents, int itemIndex, SetupProject setupProject, Action<Project, ProjectItem> itemOperation, string metadataToInsert = "", Func<string, Project> projectProvider = null) 2601var item = project.Items.ElementAt(itemIndex);
Definition\EditingElementsReferencedByOrReferences_Tests.cs (11)
35ProjectItem item = project.GetItems("I").Where(i => i.UnevaluatedInclude == "X").First(); 49IEnumerable<ProjectItem> items = project.GetItems("I"); 69ProjectItem item = project.GetItems("I").Where(i => i.EvaluatedInclude == "Y").First(); 98ProjectItem item = project.GetItems("I").Where(i => i.EvaluatedInclude == "Y").First(); 137ProjectItem item1 = project.GetItems("I").Where(i => i.EvaluatedInclude == "X").First(); 140ProjectItem item2 = project.GetItems("I").Where(i => i.EvaluatedInclude == "Y").First(); 188ProjectItem item1 = project.GetItems("I").Where(i => i.EvaluatedInclude == "X").First(); 212ProjectItem item2 = project.GetItems("I").Where(i => i.EvaluatedInclude == "Y").First(); 240ProjectItem item1 = project.GetItems("I").Where(i => i.EvaluatedInclude == "X").First(); 244ProjectItem item2 = project.GetItems("I").Where(i => i.EvaluatedInclude == "Y").First(); 286ProjectItem item = project.GetItems("I").First();
Definition\Project_Tests.cs (24)
603List<ProjectItem> items = Helpers.MakeList(project.GetItems("i")); 1669List<ProjectItem> items = Helpers.MakeList(project.GetItemsByEvaluatedInclude("i1")); 1672foreach (ProjectItem item in items) 1692List<ProjectItem> items = Helpers.MakeList(project.GetItemsByEvaluatedInclude("i&1")); 1695foreach (ProjectItem item in items) 1714List<ProjectItem> items = Helpers.MakeList(project.GetItemsByEvaluatedInclude("i2")); 1752ProjectItem itemToRemove = null; 1755foreach (ProjectItem item in project.Items) 1794List<ProjectItem> items = Helpers.MakeList(project.GetItemsByEvaluatedInclude("i1")); 1814List<ProjectItem> items = Helpers.MakeList(project.GetItemsByEvaluatedInclude("i1")); 1826ProjectItem item1 = project.AddItem("i", "i1;j1")[0]; 1829List<ProjectItem> items = Helpers.MakeList(project.GetItemsByEvaluatedInclude("i1")); 2222ProjectItem itemToRemove = Helpers.GetFirst(project.GetItems("Compile")); 2244ProjectItem itemToRemove = Helpers.GetFirst(project.GetItems("Compile")); 2293List<ProjectItem> list = new List<ProjectItem>() { project.GetItems("i").FirstOrDefault(), project.GetItems("j").FirstOrDefault() }; 2366project.RemoveItems(new List<ProjectItem>() { null }); 2404ProjectItem item = project.GetItems("i").FirstOrDefault(); 2406project.RemoveItems(new List<ProjectItem>() { item }); 2407project.RemoveItems(new List<ProjectItem>() { item }); 2510IEnumerable<ProjectItem> items = project.GetItems("i"); 4336ProjectItem item; 4343private static void GetProjectAndItemAtPosition(string project, string itemValue, int position, out Project p, out ProjectItem item) 4424IList<ProjectItem> items = Helpers.MakeList(project.GetItems("i"));
Definition\ProjectItem_Tests.cs (92)
80ProjectItem item = project.AddItem("i", "i1")[0]; 99ProjectItem item = GetOneItem(content); 125ProjectItem item = GetOneItem(content); 164ProjectItem item = Helpers.GetFirst(project.GetItems("i")); 199ProjectItem item = GetOneItem(content); 212ProjectItem item = GetOneItemFromFragment(@"<i Include='i0'/>"); 223ProjectItem item = GetOneItemFromFragment(@"<i Include='i0'/>"); 236ProjectItem item = GetOneItemFromFragment(@"<i Include='c:\foo\bar.baz'/>"); 249ProjectItem item = GetOneItemFromFragment(@"<i Include='c:\foo\bar.baz'/>"); 262ProjectItem item = GetOneItemFromFragment(@"<i Include='c:\foo\bar.baz'/>"); 273ProjectItem item = GetOneItemFromFragment(@"<i Include='c:\foo\bar.baz'/>"); 284ProjectItem item = 328ProjectItem item = GetOneItemFromFragment(@"<i Include='" + path + "'/>"); 369ProjectItem item = 416IList<ProjectItem> items = ObjectModelHelpers.GetItemsFromFragment("<i Include='i0;" + directory + (NativeMethodsShared.IsWindows ? @"\**\*;i2'/>" : "/**/*;i2'/>")); 438IList<ProjectItem> items = ObjectModelHelpers.GetItemsFromFragment(itemDefinition, allItems: false, ignoreCondition: true); 454IList<ProjectItem> items = ObjectModelHelpers.GetItemsFromFragment(itemDefinition.Replace("somedir", directory.Path), allItems: false, ignoreCondition: true); 465IList<ProjectItem> items = ObjectModelHelpers.GetItemsFromFragment("<i Include='a;b' Exclude='b;c'/>"); 491IList<ProjectItem> items = ObjectModelHelpers.GetItems(content); 519IList<ProjectItem> items = ObjectModelHelpers.GetItems(content); 1201ProjectItem item1 = project.GetItems("i").First(); 1202ProjectItem item2 = project.GetItems("j").First(); 1242ProjectItem item1 = project.GetItems("i").First(); 1243ProjectItem item1b = project.GetItems("i").ElementAt(1); 1244ProjectItem item1c = project.GetItems("i").ElementAt(2); 1245ProjectItem item2 = project.GetItems("j").First(); 1293ProjectItem item1 = project.GetItems("i").First(); 1294ProjectItem item1b = project.GetItems("i").ElementAt(1); 1295ProjectItem item2 = project.GetItems("j").First(); 1529ProjectItem item = GetOneItem(content); 1554ProjectItem item = GetOneItem(content); 1575ProjectItem item = GetOneItem(content); 1596ProjectItem item = GetOneItem(content); 1618ProjectItem item = GetOneItem(content); 1659IList<ProjectItem> items = ObjectModelHelpers.GetItems(content); 1686IList<ProjectItem> items = ObjectModelHelpers.GetItems(content); 1711IList<ProjectItem> items = ObjectModelHelpers.GetItems(content); 1736IList<ProjectItem> items = ObjectModelHelpers.GetItems(content); 1761IList<ProjectItem> items = ObjectModelHelpers.GetItems(content); 1786IList<ProjectItem> items = ObjectModelHelpers.GetItems(content); 1810IList<ProjectItem> items = ObjectModelHelpers.GetItems(content); 1834IList<ProjectItem> items = ObjectModelHelpers.GetItems(content); 1858IList<ProjectItem> items = ObjectModelHelpers.GetItems(content); 1872ProjectItem item = project.AddItem("i", "i1")[0]; 1895ProjectItem item = Helpers.GetFirst(project.GetItems("i")); 1919ProjectItem item = Helpers.GetFirst(project.GetItems("i")); 1931ProjectItem item = project.AddItem("i", "i1")[0]; 1951ProjectItem item = Helpers.GetFirst(project.GetItems("i")); 1964ProjectItem item = project.AddItem("i", "i1")[0]; 1999var projectItem = project.Items.Single(); 2022ProjectItem item = project.AddItem("i", "i1")[0]; 2040ProjectItem item = project.AddItem("i", "i1")[0]; 2067ProjectItem item = Helpers.GetFirst(project.GetItems("i")); 2098ProjectItem item = Helpers.GetFirst(project.GetItems("i")); 2122ProjectItem item = import.AddItem("i", "i1")[0]; 2185var item = project.GetItems("I").FirstOrDefault(); 2230foreach (var item in items) 2290foreach (var item in items) 2315IList<ProjectItem> items = ObjectModelHelpers.GetItemsFromFragment( 2326IList<ProjectItem> items = ObjectModelHelpers.GetItemsFromFragment( 2338IList<ProjectItem> items = ObjectModelHelpers.GetItemsFromFragment( 2349IList<ProjectItem> items = ObjectModelHelpers.GetItemsFromFragment( 2370IList<ProjectItem> items = ObjectModelHelpers.GetItemsFromFragment(content); 2656IEnumerable<ProjectItem> items = project.ItemsIgnoringCondition.Where(i => i.ItemType.Equals("I2")); 2685IEnumerable<ProjectItem> items = project.ItemsIgnoringCondition.Where(i => i.ItemType.Equals("I3")); 2722IList<ProjectItem> items = ObjectModelHelpers.GetItemsFromFragment(content); 2835IList<ProjectItem> items = ObjectModelHelpers.GetItemsFromFragment(content); 2872IList<ProjectItem> items = ObjectModelHelpers.GetItemsFromFragment(contents, allItems: true); 2916IList<ProjectItem> items = ObjectModelHelpers.GetItemsFromFragment(contents, allItems: true); 2942IList<ProjectItem> items = ObjectModelHelpers.GetItemsFromFragment(content); 2970IList<ProjectItem> items = ObjectModelHelpers.GetItemsFromFragment(content); 3024IList<ProjectItem> items = ObjectModelHelpers.GetItemsFromFragment(content, true); 3072IList<ProjectItem> items = ObjectModelHelpers.GetItemsFromFragment(content, true); 3107IList<ProjectItem> items = ObjectModelHelpers.GetItemsFromFragment(content, true); 3137IList<ProjectItem> items = ObjectModelHelpers.GetItemsFromFragment(content, true); 3166IList<ProjectItem> items = ObjectModelHelpers.GetItemsFromFragment(content, true); 3185IList<ProjectItem> items = ObjectModelHelpers.GetItemsFromFragment(content, true); 3212IList<ProjectItem> items = ObjectModelHelpers.GetItemsFromFragment(content, true); 3252IList<ProjectItem> items = ObjectModelHelpers.GetItemsFromFragment(content, true); 3339IList<ProjectItem> items = ObjectModelHelpers.GetItemsFromFragment(content, true); 3387foreach (var item in items) 3448IList<ProjectItem> items = ObjectModelHelpers.GetItemsFromFragment(content, true); 3497IList<ProjectItem> items = ObjectModelHelpers.GetItems(content); 3532IList<ProjectItem> items = ObjectModelHelpers.GetItemsFromFragment(content); 3687IList<ProjectItem> items = ObjectModelHelpers.GetItemsFromFragment(content); 3695foreach (var item in items) 3701private static List<ProjectItem> GetItemsFromFragmentWithGlobs(string itemGroupFragment, params string[] globFiles) 3705List<ProjectItem> itemsFromFragmentWithGlobs; 3720private static ProjectItem GetOneItemFromFragment(string fragment) 3722IList<ProjectItem> items = ObjectModelHelpers.GetItemsFromFragment(fragment); 3732private static ProjectItem GetOneItem(string content) 3734IList<ProjectItem> items = ObjectModelHelpers.GetItems(content);
Definition\ProjectItemDefinition_Tests.cs (7)
248ProjectItem item = project.GetItems("i").ElementAt(0); 275ProjectItem item = project.GetItems("i").ElementAt(0); 302ProjectItem item = project.GetItems("i").ElementAt(0); 333ProjectItem item = project.GetItems("i").ElementAt(0); 361ProjectItem item = project.GetItems("i").ElementAt(0); 391ProjectItem item = project.GetItems("i").ElementAt(0); 419ProjectItem item = project.GetItems("i").ElementAt(0);
Definition\ProjectMetadata_Tests.cs (8)
30ProjectItem item = project.AddItem("i", "i1")[0]; 90ProjectItem item = project.AddItem("i", "i1")[0]; 111ProjectItem item = project.AddItem("i", "i1")[0]; 129ProjectItem item = project.AddItem("j", "j1")[0]; 469ProjectItem item = Helpers.GetFirst(project.GetItems("i")); 494ProjectItem item = project.GetItems("None").Single(); 511Microsoft.Build.Evaluation.ProjectItem item = project.AddItem( 524private void SpecialCharactersInMetadataValueTests(Microsoft.Build.Evaluation.ProjectItem item)
Definition\ProtectImports_Tests.cs (27)
185ProjectItem item = GetImportedItem(project); 200ProjectItem item = GetImportedItem(project); 215ProjectItem item = GetImportedItem(project); 230ProjectItem item = GetImportedItem(project); 243ProjectItem item = GetProjectItem(project); 257ProjectItem item = GetProjectItem(project); 271ProjectItem item = GetProjectItem(project); 285ProjectItem item = GetProjectItem(project); 305ProjectItem item = GetImportedItem(project); 320ProjectItem item = GetImportedItem(project); 350ProjectItem item = GetImportedItem(project); 363ProjectItem item = GetProjectItem(project); 377ProjectItem item = GetProjectItem(project); 408ProjectItem item = GetProjectItem(project); 443ProjectItem item = GetProjectItem(project); 456ProjectItem item = GetProjectItem(project); 484ProjectItem item = GetProjectItem(project); 523private ProjectItem GetImportedItem(Project project) 525IEnumerable<ProjectItem> items = project.GetItems(ItemType).Where(pi => pi.IsImported); 528ProjectItem item = items.First(); 541ProjectItem item = GetImportedItem(project); 558ProjectItem item = GetProjectItem(project); 575ProjectItem item = GetProjectItem(project); 630private ProjectItem GetProjectItem(Project project) 632IEnumerable<ProjectItem> items = project.GetItems(ItemType).Where(pi => !pi.IsImported); 635ProjectItem item = items.First(); 648ProjectItem item = GetProjectItem(project);
ObjectModelRemoting\Helpers\ViewValidation.cs (1)
265if (VerifyCheckType<ProjectItem>(view, real, context, Verify))
ObjectModelRemoting\Helpers\ViewValidation.evaluation.cs (8)
27private ProjectItem VerifyAfterAddSingleItem(ObjectType where, ICollection<ProjectItem> added, IEnumerable<KeyValuePair<string, string>> metadata) 31var result = added.First(); 52public ProjectItem AddSingleItemWithVerify(ObjectType where, string itemType, string unevaluatedInclude, IEnumerable<KeyValuePair<string, string>> metadata = null) 59public ProjectItem AddSingleItemFastWithVerify(ObjectType where, string itemType, string unevaluatedInclude, IEnumerable<KeyValuePair<string, string>> metadata = null) 66public ProjectItem GetSingleItemWithVerify(ObjectType which, string evaluatedInclude) 206public static void Verify(ProjectItem view, ProjectItem real, ValidationContext context = null)
ObjectModelRemoting\LinkedEvaluationModify_Tests.cs (15)
129var fooView = pair.AddSingleItemWithVerify(ObjectType.View, "cpp", "foo.cpp"); 132var fooViewFast = pair.AddSingleItemFastWithVerify(ObjectType.View, "cpp", "fooFast.cpp"); 135var fooWithMetadataView = pair.AddSingleItemWithVerify(ObjectType.View, "cpp", "fooWithMetadata.cpp", testMedatada); 138var fooWithMetadataViewFast = pair.AddSingleItemWithVerify(ObjectType.View, "cpp", "fooWithMetadataFast.cpp", testMedatada); 142var barReal = pair.AddSingleItemWithVerify(ObjectType.Real, "cpp", "bar.cpp"); 145var barRealFast = pair.AddSingleItemFastWithVerify(ObjectType.Real, "cpp", "barFast.cpp"); 148var barWithMetadataReal = pair.AddSingleItemWithVerify(ObjectType.Real, "cpp", "barWithMetadata.cpp", testMedatada); 151var barWithMetadataRealFast = pair.AddSingleItemWithVerify(ObjectType.Real, "cpp", "barWithMetadataFast.cpp", testMedatada); 162var barWithMetadataViewFast = pair.GetSingleItemWithVerify(ObjectType.View, "barWithMetadataFast.cpp"); 178var barWithMetadataView = pair.GetSingleItemWithVerify(ObjectType.View, "barWithMetadata.cpp"); 181var toRemoveView = new List<ProjectItem>() { barWithMetadataView, fooWithMetadataView }; 197var fooWithMetadataRealFast = pair.GetSingleItemWithVerify(ObjectType.Real, "fooWithMetadataFast.cpp"); 216var fooRealFast = pair.GetSingleItemWithVerify(ObjectType.Real, "fooFast.cpp"); 219var toRemoveReal = new List<ProjectItem>() { fooRealFast, barRealFast }; 233var fooReal = pair.GetSingleItemWithVerify(ObjectType.Real, "foo.cpp");
ObjectModelRemoting\RemoteProjectsProviderMock\EvaluationLinkMocks\MockProjectItemLink.cs (2)
13internal sealed class MockProjectItemLinkRemoter : MockLinkRemoter<ProjectItem> 15public override ProjectItem CreateLinkedObject(IImportHolder holder)
ObjectModelRemoting\RemoteProjectsProviderMock\EvaluationLinkMocks\MockProjectLink.cs (31)
48public ICollection<MockProjectItemLinkRemoter> Items => this.OwningCollection.ExportCollection<ProjectItem, MockProjectItemLinkRemoter>(this.Source.Items); 50public ICollection<MockProjectItemLinkRemoter> ItemsIgnoringCondition => this.OwningCollection.ExportCollection<ProjectItem, MockProjectItemLinkRemoter>(this.Source.ItemsIgnoringCondition); 64public ICollection<MockProjectItemLinkRemoter> AllEvaluatedItems => this.OwningCollection.ExportCollection<ProjectItem, MockProjectItemLinkRemoter>(this.Source.AllEvaluatedItems); 73=> this.OwningCollection.ExportCollection<ProjectItem, MockProjectItemLinkRemoter>(this.Source.AddItem(itemType, unevaluatedInclude, metadata)); 75=> this.OwningCollection.ExportCollection<ProjectItem, MockProjectItemLinkRemoter>(this.Source.AddItemFast(itemType, unevaluatedInclude, metadata)); 80=> this.OwningCollection.ExportCollection<ProjectItem, MockProjectItemLinkRemoter>(this.Source.GetItems(itemType)); 83=> this.OwningCollection.ExportCollection<ProjectItem, MockProjectItemLinkRemoter>(this.Source.GetItemsByEvaluatedInclude(evaluatedInclude)); 86=> this.OwningCollection.ExportCollection<ProjectItem, MockProjectItemLinkRemoter>(this.Source.GetItemsIgnoringCondition(itemType)); 97public bool RemoveItem(MockProjectItemLinkRemoter item) => this.Source.RemoveItem(this.OwningCollection.Import<ProjectItem, MockProjectItemLinkRemoter>(item)); 100=> this.Source.RemoveItems(this.OwningCollection.ImportCollection<ProjectItem, MockProjectItemLinkRemoter>(items)); 148public override ICollection<ProjectItem> Items => this.Linker.ImportCollection<ProjectItem, MockProjectItemLinkRemoter>(this.Proxy.Items); 150public override ICollection<ProjectItem> ItemsIgnoringCondition => this.Linker.ImportCollection<ProjectItem, MockProjectItemLinkRemoter>(this.Proxy.ItemsIgnoringCondition); 163public override ICollection<ProjectItem> AllEvaluatedItems 164=> this.Linker.ImportCollection<ProjectItem, MockProjectItemLinkRemoter>(this.Proxy.AllEvaluatedItems); 176public override IList<ProjectItem> AddItem(string itemType, string unevaluatedInclude, IEnumerable<KeyValuePair<string, string>> metadata) 177=> this.Linker.ImportCollection<ProjectItem, MockProjectItemLinkRemoter>(this.Proxy.AddItem(itemType, unevaluatedInclude, metadata)); 179public override IList<ProjectItem> AddItemFast(string itemType, string unevaluatedInclude, IEnumerable<KeyValuePair<string, string>> metadata) 180=> this.Linker.ImportCollection<ProjectItem, MockProjectItemLinkRemoter>(this.Proxy.AddItemFast(itemType, unevaluatedInclude, metadata)); 211public override List<ProvenanceResult> GetItemProvenance(ProjectItem item, EvaluationContext evaluationContext) 217public override ICollection<ProjectItem> GetItems(string itemType) 218=> this.Linker.ImportCollection<ProjectItem, MockProjectItemLinkRemoter>(this.Proxy.GetItems(itemType)); 219public override ICollection<ProjectItem> GetItemsByEvaluatedInclude(string evaluatedInclude) 220=> this.Linker.ImportCollection<ProjectItem, MockProjectItemLinkRemoter>(this.Proxy.GetItemsByEvaluatedInclude(evaluatedInclude)); 222public override ICollection<ProjectItem> GetItemsIgnoringCondition(string itemType) 223=> this.Linker.ImportCollection<ProjectItem, MockProjectItemLinkRemoter>(this.Proxy.GetItemsIgnoringCondition(itemType)); 234public override bool RemoveItem(ProjectItem item) 235=> this.Proxy.RemoveItem(this.Linker.Export<ProjectItem, MockProjectItemLinkRemoter>(item)); 237public override void RemoveItems(IEnumerable<ProjectItem> items) 238=> this.Proxy.RemoveItems(this.Linker.ExportCollection<ProjectItem, MockProjectItemLinkRemoter>(items));
ObjectModelRemoting\RemoteProjectsProviderMock\EvaluationLinkMocks\MockProjectMetadataLink.cs (4)
31var itemParent = parent as ProjectItem; 34return this.OwningCollection.Export<ProjectItem, MockProjectItemLinkRemoter>(itemParent); 73return this.Linker.Import<ProjectItem, MockProjectItemLinkRemoter>(itemParent);
Microsoft.Build.Engine.UnitTests (36)
Definition\ItemDefinitionGroup_Tests.cs (1)
1866foreach (ProjectItem item in project.GetItems(itemType))
Definition\ProjectItem_Tests.cs (9)
12using ProjectItemFactory = Microsoft.Build.Evaluation.ProjectItem.ProjectItemFactory; 29ProjectItem item1 = GetOneItemFromFragment(@"<i Include='i1'><m>m1</m></i>"); 31ProjectItem item2 = factory.CreateItem(item1, item1.Project.FullPath); 47private static IList<ProjectItem> GetItemsFromFragment(string fragment) 59IList<ProjectItem> items = GetItems(content); 67private static ProjectItem GetOneItemFromFragment(string fragment) 69IList<ProjectItem> items = GetItemsFromFragment(fragment); 78private static IList<ProjectItem> GetItems(string content) 84IList<ProjectItem> item = Helpers.MakeList(project.GetItems("i"));
EscapingInProjects_Tests.cs (13)
365IEnumerable<ProjectItem> newItems = EscapingInProjectsHelper.ModifyItemOfTypeInProject(project, "MyWildcard", "b.weirdo", "foo%253Bbar.weirdo"); 473IEnumerable<ProjectItem> newItems = project.AddItem("MyWildCard", "foo%253bbar.weirdo"); 515IEnumerable<ProjectItem> newItems = project.AddItem("MyWildCard", "foo.AAA%253bBBB"); 834ProjectItem item = project.GetItems("None").Single(); 846ProjectItem item = project.AddItem("None", "MetadataTests", new Dictionary<string, string> { 880IEnumerable<ProjectItem> items = project.GetItems("DifferentList"); 912IEnumerable<ProjectItem> items = project.GetItems("DifferentList"); 1818internal static IEnumerable<ProjectItem> ModifyItemOfTypeInProject(Project project, string itemType, string oldEvaluatedInclude, string newEvaluatedInclude) 1820IEnumerable<ProjectItem> itemsToMatch = project.GetItems(itemType); 1821List<ProjectItem> matchingItems = new List<ProjectItem>(); 1823foreach (ProjectItem item in itemsToMatch) 1842internal static void SpecialCharactersInMetadataValueTests(ProjectItem item)
Evaluation\Evaluator_Tests.cs (1)
1555ProjectItem item = project.AddItem("i", "i1")[0];
Evaluation\ItemEvaluation_Tests.cs (8)
59IList<ProjectItem> items = ObjectModelHelpers.GetItemsFromFragment(content, allItems: true); 108IList<ProjectItem> items = ObjectModelHelpers.GetItemsFromFragment(content, allItems: true); 132IList<ProjectItem> items = ObjectModelHelpers.GetItemsFromFragment(content, allItems: true); 150IList<ProjectItem> items = ObjectModelHelpers.GetItemsFromFragment(content, allItems: true); 181IList<ProjectItem> items = ObjectModelHelpers.GetItemsFromFragment(content, allItems: true); 488IList<ProjectItem> items = ObjectModelHelpers.GetItemsFromFragment(content, allItems: true); 543IList<ProjectItem> items = ObjectModelHelpers.GetItemsFromFragment(content.ToString()); 555IList<ProjectItem> items = ObjectModelHelpers.GetItemsFromFragment(content);
Evaluation\SdkResultEvaluation_Tests.cs (3)
83foreach (var item in itemsFromResolver) 95private void ValidateItemFromResolver(ProjectItem item) 455var item = itemsFromResolver.ShouldHaveSingleItem();
Parser_Tests.cs (1)
579var projectItem = project.GetItems("A").FirstOrDefault();
Microsoft.Build.UnitTests.Shared (14)
ObjectModelHelpers.cs (14)
106public static ProjectItem AssertSingleItem(Project p, string type, string itemInclude) 108ProjectItem[] items = p.GetItems(type).ToArray(); 110foreach (ProjectItem item in items) 211private readonly ProjectItem _projectInstance; 213public ProjectItemTestItemAdapter(ProjectItem projectInstance) 222public static implicit operator ProjectItemTestItemAdapter(ProjectItem pi) 247public static void AssertItems(string[] expectedItems, ICollection<ProjectItem> items, Dictionary<string, string> expectedDirectMetadata = null, bool normalizeSlashes = false) 274public static void AssertItems(string[] expectedItems, IList<ProjectItem> items, Dictionary<string, string>[] expectedDirectMetadataPerItem, bool normalizeSlashes = false) 457public static void AssertItemHasMetadata(Dictionary<string, string> expected, ProjectItem item) 462public static void AssertItemHasMetadata(string key, string value, ProjectItem item) 1083public static IList<ProjectItem> GetItemsFromFragment(string fragment, bool allItems = false, bool ignoreCondition = false) 1087IList<ProjectItem> items = GetItems(content, allItems, ignoreCondition); 1099public static IList<ProjectItem> GetItems(string content, bool allItems = false, bool ignoreCondition = false) 1104IList<ProjectItem> item = Helpers.MakeList(
Microsoft.CodeAnalysis.Workspaces.MSBuild.BuildHost (12)
MSBuild\ProjectFile\ProjectFile.cs (12)
300private IDictionary<string, MSB.Evaluation.ProjectItem>? _documents; 306_documents = new Dictionary<string, MSB.Evaluation.ProjectItem>(); 312foreach (var item in _loadedProject.GetItems(ItemNames.Compile)) 392var item = items.FirstOrDefault(it => PathUtilities.PathsEqual(it.EvaluatedInclude, relativePath) 424var item = FindReferenceItem(shortAssemblyName, fullAssemblyName, filePath); 431private MSB.Evaluation.ProjectItem FindReferenceItem(string shortAssemblyName, string fullAssemblyName, string filePath) 436MSB.Evaluation.ProjectItem? item = null; 471private static string GetHintPath(MSB.Evaluation.ProjectItem item) 502var item = FindProjectReferenceItem(projectName, projectFilePath); 509private MSB.Evaluation.ProjectItem? FindProjectReferenceItem(string projectName, string projectFilePath) 519MSB.Evaluation.ProjectItem? item = null; 552var item = analyzers.FirstOrDefault(it => PathUtilities.PathsEqual(it.EvaluatedInclude, relativePath)
MSBuild (1)
JsonOutputFormatter.cs (1)
95foreach (ProjectItem item in project.GetItems(itemName))