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)
The TaskItem type exposes the following members.
| Name | Description | |
|---|---|---|
![]() | TaskItem() | Initializes a new instance of the TaskItem class. |
![]() | TaskItem(ITaskItem) | Initializes a new instance of the TaskItem class using the specified source ITaskItem. |
![]() | TaskItem(String) | Initializes a new instance of the TaskItem class using the specified item-specification string. |
![]() | TaskItem(String, IDictionary) | Initializes a new instance of the TaskItem class using the specified item-specification string and its metadata. |
| Name | Description | |
|---|---|---|
![]() | ItemSpec | Gets or sets the item specification. |
![]() | MetadataCount | Gets the number of metadata set on the item. |
![]() | MetadataNames | Gets the names of all the metadata on the item. |
| Name | Description | |
|---|---|---|
![]() | CloneCustomMetadata | Clones the collection of custom metadata for the item specification. |
![]() | CopyMetadataTo | Copies the item-specification metadata to the specified destination task item. |
![]() | CreateObjRef | Creates an object that contains all the relevant information required to generate a proxy used to communicate with a remote object. (Inherited from MarshalByRefObject.) |
![]() | Equals(Object) | Determines whether the specified object is equal to the current object. (Inherited from Object.) |
![]() | GetHashCode | Serves as a hash function for a particular type. (Inherited from Object.) |
![]() | GetLifetimeService | Retrieves the current lifetime service object that controls the lifetime policy for this instance. (Inherited from MarshalByRefObject.) |
![]() | GetMetadata | Retrieves the specified metadata on the item. |
![]() | GetType | Gets the Type of the current instance. (Inherited from Object.) |
![]() | InitializeLifetimeService | When overridden in a derived class, gives task items infinite lease time. (Overrides MarshalByRefObject.InitializeLifetimeService().) |
![]() | RemoveMetadata | Removes the specified metadata on the item. |
![]() | SetMetadata | Sets or modifies the value of the specified metadata on the item. |
![]() | ToString | Gets the item specification. (Overrides Object.ToString().) |
| Name | Description | |
|---|---|---|
![]() ![]() | Explicit(TaskItem to String) | Allows an explicit type cast from a TaskItem to a String, and returns the ItemSpec for that item. |
| Name | Description | |
|---|---|---|
![]() ![]() | ITaskItem2.CloneCustomMetadataEscaped | ITaskItem2 implementation which returns a clone of the metadata on this object. Values returned are in their original escaped form. |
![]() ![]() | ITaskItem2.EvaluatedIncludeEscaped | ITaskItem2 implementation which gets or sets the item include value. For disk-based items this would be the file path. |
![]() ![]() | ITaskItem2.GetMetadataValueEscaped | ITaskItem2 implementation which allows the values of metadata on the item to be queried. |
![]() ![]() | ITaskItem2.SetMetadataValueLiteral | 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. |
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.
Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

