共用方式為


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

Adds an item with metadata to the project. Metadata may be null, indicating no metadata. Makes no effort to see if an existing wildcard would already match the new item, unless it is the first item in an item group. Makes no effort to locate the new item near similar items.

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 AddItemFast ( _
    itemType As String, _
    unevaluatedInclude As String, _
    metadata As IEnumerable(Of KeyValuePair(Of String, String)) _
) As IList(Of ProjectItem)
public IList<ProjectItem> AddItemFast(
    string itemType,
    string unevaluatedInclude,
    IEnumerable<KeyValuePair<string, string>> metadata
)
public:
IList<ProjectItem^>^ AddItemFast(
    String^ itemType, 
    String^ unevaluatedInclude, 
    IEnumerable<KeyValuePair<String^, String^>>^ metadata
)
member AddItemFast : 
        itemType:string * 
        unevaluatedInclude:string * 
        metadata:IEnumerable<KeyValuePair<string, string>> -> IList<ProjectItem> 
public function AddItemFast(
    itemType : String, 
    unevaluatedInclude : String, 
    metadata : IEnumerable<KeyValuePair<String, String>>
) : IList<ProjectItem>

Parameters

  • unevaluatedInclude
    Type: System.String

    The unevaluated Include attribute to be added to the item.

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

    The metadata to be added.

Return Value

Type: IList<ProjectItem>
Returns a list of the project items added.

Remarks

Appends the item to the first item group that does not have a condition and has either no children or whose first child is an item of the same type.

Evaluates on a best-effort basis: -expands with all items. Items that are defined in the XML below the new item may be used, even though in a real evaluation they would not be.

Only this item is evaluated. Other items that might depend on it is not affected.

This is a convenience that it is understood does not necessarily leave the project in a perfectly self consistent state until reevaluation.

.NET Framework Security

See Also

Reference

Project Class

AddItemFast Overload

Microsoft.Build.Evaluation Namespace