TaskItem Class

 

Defines a single item of the project as it is passed into a task.

Namespace:   Microsoft.Build.Utilities
Assembly:  Microsoft.Build.Utilities.v4.0 (in Microsoft.Build.Utilities.v4.0.dll)

System.Object
  System.MarshalByRefObject
    Microsoft.Build.Utilities.TaskItem

public sealed class TaskItem : MarshalByRefObject, ITaskItem, 
	ITaskItem2

NameDescription
System_CAPS_pubmethodTaskItem()

Initializes a new instance of the TaskItem class.

System_CAPS_pubmethodTaskItem(ITaskItem)

Initializes a new instance of the TaskItem class using the specified source ITaskItem.

System_CAPS_pubmethodTaskItem(String)

Initializes a new instance of the TaskItem class using the specified item-specification string.

System_CAPS_pubmethodTaskItem(String, IDictionary)

Initializes a new instance of the TaskItem class using the specified item-specification string and its metadata.

NameDescription
System_CAPS_pubpropertyItemSpec

Gets or sets the item specification.

System_CAPS_pubpropertyMetadataCount

Gets the number of metadata set on the item.

System_CAPS_pubpropertyMetadataNames

Gets the names of all the metadata on the item.

NameDescription
System_CAPS_pubmethodCloneCustomMetadata()

Clones the collection of custom metadata for the item specification.

System_CAPS_pubmethodCopyMetadataTo(ITaskItem)

Copies the item-specification metadata to the specified destination task item.

System_CAPS_pubmethodCreateObjRef(Type)

Creates an object that contains all the relevant information required to generate a proxy used to communicate with a remote object.(Inherited from MarshalByRefObject.)

System_CAPS_pubmethodEquals(Object)

Determines whether the specified object is equal to the current object.(Inherited from Object.)

System_CAPS_pubmethodGetHashCode()

Serves as the default hash function. (Inherited from Object.)

System_CAPS_pubmethodGetLifetimeService()

Retrieves the current lifetime service object that controls the lifetime policy for this instance.(Inherited from MarshalByRefObject.)

System_CAPS_pubmethodGetMetadata(String)

Retrieves the specified metadata on the item.

System_CAPS_pubmethodGetType()

Gets the Type of the current instance.(Inherited from Object.)

System_CAPS_pubmethodInitializeLifetimeService()

When overridden in a derived class, gives task items infinite lease time.(Overrides MarshalByRefObject.InitializeLifetimeService().)

System_CAPS_pubmethodRemoveMetadata(String)

Removes the specified metadata on the item.

System_CAPS_pubmethodSetMetadata(String, String)

Sets or modifies the value of the specified metadata on the item.

System_CAPS_pubmethodToString()

Gets the item specification.(Overrides Object.ToString().)

NameDescription
System_CAPS_puboperatorSystem_CAPS_staticExplicit(TaskItem to String)

Allows an explicit type cast from a TaskItem to a String, and returns the ItemSpec for that item.

NameDescription
System_CAPS_pubinterfaceSystem_CAPS_privmethodITaskItem2.CloneCustomMetadataEscaped()

ITaskItem2 implementation which returns a clone of the metadata on this object. Values returned are in their original escaped form.

System_CAPS_pubinterfaceSystem_CAPS_privmethodITaskItem2.GetMetadataValueEscaped(String)

ITaskItem2 implementation which allows the values of metadata on the item to be queried.

System_CAPS_pubinterfaceSystem_CAPS_privmethodITaskItem2.SetMetadataValueLiteral(String, String)

ITaskItem2 implementation which allows a piece of custom metadata to be set on the item. Assumes that the value passed in is unescaped, and escapes the value as necessary in order to maintain its value.

System_CAPS_pubinterfaceSystem_CAPS_privpropertyITaskItem2.EvaluatedIncludeEscaped

ITaskItem2 implementation which gets or sets the item include value. For disk-based items this would be the file path.

TaskItem objects do not exactly correspond to item elements in project files. If they did, then tasks would have access to data that was not explicitly passed into the task through the project file. This is not a security issue, but rather an issue with project file clarity and transparency.

This class has to be sealed since the build engine instantiates its own copy of this type. If a third party were to extend this class, then the build engine will yield an undesired behavior.

.NET Framework
Available since 2.0

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Return to top
Show: