Condividi tramite


Project.AddNewItem Method (String, String, Boolean)

Adds the specified Item element 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.BuildEngine
Assembly:  Microsoft.Build.Engine (in Microsoft.Build.Engine.dll)

Syntax

'Declaration
Public Function AddNewItem ( _
    itemName As String, _
    itemInclude As String, _
    treatItemIncludeAsLiteral As Boolean _
) As BuildItem
public BuildItem AddNewItem(
    string itemName,
    string itemInclude,
    bool treatItemIncludeAsLiteral
)
public:
BuildItem^ AddNewItem(
    String^ itemName, 
    String^ itemInclude, 
    bool treatItemIncludeAsLiteral
)
member AddNewItem : 
        itemName:string * 
        itemInclude:string * 
        treatItemIncludeAsLiteral:bool -> BuildItem
public function AddNewItem(
    itemName : String, 
    itemInclude : String, 
    treatItemIncludeAsLiteral : boolean
) : BuildItem

Parameters

  • itemName
    Type: System.String

    The name of the item collection to add the item to. Corresponds to the user-defined name of the Item element.

  • itemInclude
    Type: System.String

    The value of the Include attribute of the item.

  • treatItemIncludeAsLiteral
    Type: System.Boolean

    true to treat the itemInclude parameter as a literal value; otherwise, false.

Return Value

Type: Microsoft.Build.BuildEngine.BuildItem
A BuildItem containing the created item.

Remarks

This method attempts to add the item to the project near the other items in the item collection.

.NET Framework Security

See Also

Reference

Project Class

AddNewItem Overload

Microsoft.Build.BuildEngine Namespace