共用方式為


Project.AddNewItem Method (String, String)

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 _
) As BuildItem
public BuildItem AddNewItem(
    string itemName,
    string itemInclude
)
public:
BuildItem^ AddNewItem(
    String^ itemName, 
    String^ itemInclude
)
member AddNewItem : 
        itemName:string * 
        itemInclude:string -> BuildItem
public function AddNewItem(
    itemName : String, 
    itemInclude : String
) : 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.

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