Share via


Project.AddItem Method (String, String, IEnumerable<KeyValuePair<String, String>>)

Adds an item with the given metadata to the project.

MSBuild is now included in Visual Studio instead of the .NET Framework. You can use MSBuild 12.0 side-by-side with versions previously deployed with the .NET Framework.For more information, see What's New in MSBuild 12.0.

Namespace:  Microsoft.Build.Evaluation
Assembly:  Microsoft.Build (in Microsoft.Build.dll)

Syntax

'Declaration
Public Function AddItem ( _
    itemType As String, _
    unevaluatedInclude As String, _
    metadata As IEnumerable(Of KeyValuePair(Of String, String)) _
) As IList(Of ProjectItem)
public IList<ProjectItem> AddItem(
    string itemType,
    string unevaluatedInclude,
    IEnumerable<KeyValuePair<string, string>> metadata
)
public:
IList<ProjectItem^>^ AddItem(
    String^ itemType, 
    String^ unevaluatedInclude, 
    IEnumerable<KeyValuePair<String^, String^>>^ metadata
)
member AddItem : 
        itemType:string * 
        unevaluatedInclude:string * 
        metadata:IEnumerable<KeyValuePair<string, string>> -> IList<ProjectItem> 
public function AddItem(
    itemType : String, 
    unevaluatedInclude : String, 
    metadata : IEnumerable<KeyValuePair<String, String>>
) : IList<ProjectItem>

Parameters

  • unevaluatedInclude
    Type: System.String

    Include attribute of the item to be added.

  • metadata
    Type: IEnumerable<KeyValuePair<String, String>>

    The metadata of the added item.

Return Value

Type: IList<ProjectItem>
Returns the added item.

Remarks

The metadata may be null, which indicates no metadata.

Evaluation takes place on a best-effort basis. Items that are defined in the project source following the new item may be used for evaluation. Only this item is evaluated. Other items that might depend on it are not affected.

.NET Framework Security

See Also

Reference

Project Class

AddItem Overload

Microsoft.Build.Evaluation Namespace