Share via


TargetCollection Class

Definition

This class (and the whole namespace) is deprecated. Please use the classes in these namespaces instead: Microsoft.Build.ConstructionMicrosoft.Build.EvaluationMicrosoft.Build.Execution

This class represents a collection of persisted <Target>'s. Each MSBuild project has exactly one TargetCollection, which includes all the imported Targets as well as the ones in the main project file.

public ref class TargetCollection : System::Collections::ICollection
public class TargetCollection : System.Collections.ICollection
type TargetCollection = class
    interface IEnumerable
    interface ICollection
type TargetCollection = class
    interface ICollection
    interface IEnumerable
Public Class TargetCollection
Implements ICollection
Inheritance
TargetCollection
Implements

Remarks

Warning

This class (and the whole namespace) is deprecated. Please use the classes in these namespaces instead: Microsoft.Build.Construction Microsoft.Build.Evaluation Microsoft.Build.Execution

Properties

Count

This method (and the whole namespace) is deprecated. Please use the classes in these namespaces instead: Microsoft.Build.ConstructionMicrosoft.Build.EvaluationMicrosoft.Build.Execution

Read-only property which returns the number of Targets contained in our collection.

IsSynchronized

This method (and the whole namespace) is deprecated. Please use the classes in these namespaces instead: Microsoft.Build.ConstructionMicrosoft.Build.EvaluationMicrosoft.Build.Execution

This ICollection property tells whether this object is thread-safe.

Item[String]

This method (and the whole namespace) is deprecated. Please use the classes in these namespaces instead: Microsoft.Build.ConstructionMicrosoft.Build.EvaluationMicrosoft.Build.Execution

Gets the target with the given name, case-insensitively. Note that this also defines the .BuildItem() accessor automagically.

SyncRoot

This method (and the whole namespace) is deprecated. Please use the classes in these namespaces instead: Microsoft.Build.ConstructionMicrosoft.Build.EvaluationMicrosoft.Build.Execution

This ICollection property returns the object to be used to synchronize access to the class.

Methods

AddNewTarget(String)

This method (and the whole namespace) is deprecated. Please use the classes in these namespaces instead: Microsoft.Build.ConstructionMicrosoft.Build.EvaluationMicrosoft.Build.Execution

Adds a new <Target> element to the project file, at the very end.

CopyTo(Array, Int32)

This method (and the whole namespace) is deprecated. Please use the classes in these namespaces instead: Microsoft.Build.ConstructionMicrosoft.Build.EvaluationMicrosoft.Build.Execution

This ICollection method copies the contents of this collection to an array.

Exists(String)

This method (and the whole namespace) is deprecated. Please use the classes in these namespaces instead: Microsoft.Build.ConstructionMicrosoft.Build.EvaluationMicrosoft.Build.Execution

Checks if a target with given name already exists

GetEnumerator()

This method (and the whole namespace) is deprecated. Please use the classes in these namespaces instead: Microsoft.Build.ConstructionMicrosoft.Build.EvaluationMicrosoft.Build.Execution

This IEnumerable method returns an IEnumerator object, which allows the caller to enumerate through the Target objects contained in this TargetCollection.

RemoveTarget(Target)

This method (and the whole namespace) is deprecated. Please use the classes in these namespaces instead: Microsoft.Build.ConstructionMicrosoft.Build.EvaluationMicrosoft.Build.Execution

Removes a target from the project, and removes the corresponding <Target> element from the project's XML.

Applies to