ProjectRootElement.AddItem Method

Definition

Adds an item to this project.

Overloads

AddItem(String, String)

Convenience method that picks a location based on a heuristic: Finds item group with no condition with at least one item of same type, or else adds a new item group; adds the item to that item group with items of the same type, ordered by include.

AddItem(String, String, IEnumerable<KeyValuePair<String,String>>)

Convenience method that picks a location based on a heuristic: Finds first item group with no condition with at least one item of same type, or else an empty item group; or else adds a new item group; adds the item to that item group with items of the same type, ordered by include. Does not attempt to check whether the item matches an existing wildcard expression; that is only possible in the evaluated world.

AddItem(String, String)

Convenience method that picks a location based on a heuristic: Finds item group with no condition with at least one item of same type, or else adds a new item group; adds the item to that item group with items of the same type, ordered by include.

public:
 Microsoft::Build::Construction::ProjectItemElement ^ AddItem(System::String ^ itemType, System::String ^ include);
public Microsoft.Build.Construction.ProjectItemElement AddItem (string itemType, string include);
[System.Runtime.TargetedPatchingOptOut("Performance critical to inline this type of method across NGen image boundaries")]
public Microsoft.Build.Construction.ProjectItemElement AddItem (string itemType, string include);
member this.AddItem : string * string -> Microsoft.Build.Construction.ProjectItemElement
[<System.Runtime.TargetedPatchingOptOut("Performance critical to inline this type of method across NGen image boundaries")>]
member this.AddItem : string * string -> Microsoft.Build.Construction.ProjectItemElement
Public Function AddItem (itemType As String, include As String) As ProjectItemElement

Parameters

itemType
String

The item type of the item to be added.

include
String

The Include value of the item to be added.

Returns

The added item.

Attributes

Remarks

Per the previous implementation, it actually finds the last suitable item group, not the first.

Applies to

AddItem(String, String, IEnumerable<KeyValuePair<String,String>>)

Convenience method that picks a location based on a heuristic: Finds first item group with no condition with at least one item of same type, or else an empty item group; or else adds a new item group; adds the item to that item group with items of the same type, ordered by include. Does not attempt to check whether the item matches an existing wildcard expression; that is only possible in the evaluated world.

public:
 Microsoft::Build::Construction::ProjectItemElement ^ AddItem(System::String ^ itemType, System::String ^ include, System::Collections::Generic::IEnumerable<System::Collections::Generic::KeyValuePair<System::String ^, System::String ^>> ^ metadata);
public Microsoft.Build.Construction.ProjectItemElement AddItem (string itemType, string include, System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<string,string>> metadata);
member this.AddItem : string * string * seq<System.Collections.Generic.KeyValuePair<string, string>> -> Microsoft.Build.Construction.ProjectItemElement
Public Function AddItem (itemType As String, include As String, metadata As IEnumerable(Of KeyValuePair(Of String, String))) As ProjectItemElement

Parameters

itemType
String

The item type of the item to be added.

include
String

The Include value of the item to be added.

metadata
IEnumerable<KeyValuePair<String,String>>

The metadata to be added.

Returns

The added item.

Remarks

Per the previous implementation, it actually finds the last suitable item group, not the first.

Applies to