TaskItem Class
Defines a single item of the project as it is passed into a task.
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.
Inheritance Hierarchy
System.Object
System.MarshalByRefObject
Microsoft.Build.Utilities.TaskItem
Namespace: Microsoft.Build.Utilities
Assembly: Microsoft.Build.Utilities.Core (in Microsoft.Build.Utilities.Core.dll)
Syntax
'Declaration
Public NotInheritable Class TaskItem _
Inherits MarshalByRefObject _
Implements ITaskItem, ITaskItem2
public sealed class TaskItem : MarshalByRefObject,
ITaskItem, ITaskItem2
public ref class TaskItem sealed : public MarshalByRefObject,
ITaskItem, ITaskItem2
[<Sealed>]
type TaskItem =
class
inherit MarshalByRefObject
interface ITaskItem
interface ITaskItem2
end
public final class TaskItem extends MarshalByRefObject implements ITaskItem, ITaskItem2
The TaskItem type exposes the following members.
Constructors
Name | Description | |
---|---|---|
TaskItem() | Initializes a new instance of the TaskItem class.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. | |
TaskItem(String) | Initializes a new instance of the TaskItem class using the specified item-specification string.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. | |
TaskItem(ITaskItem) | Initializes a new instance of the TaskItem class using the specified source ITaskItem.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. | |
TaskItem(String, IDictionary) | Initializes a new instance of the TaskItem class using the specified item-specification string and its metadata.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. |
Top
Properties
Name | Description | |
---|---|---|
ItemSpec | Gets or sets the item specification.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. | |
MetadataCount | Gets the number of metadata set on the item.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. | |
MetadataNames | Gets the names of all the metadata on the item.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. |
Top
Methods
Name | Description | |
---|---|---|
CloneCustomMetadata | Clones the collection of custom metadata for the item specification.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. | |
CopyMetadataTo | Copies the item-specification metadata to the specified destination task item.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. | |
CreateObjRef | Security Critical. (Inherited from MarshalByRefObject.) | |
Equals | (Inherited from Object.) | |
GetHashCode | (Inherited from Object.) | |
GetLifetimeService | Security Critical. (Inherited from MarshalByRefObject.) | |
GetMetadata | Retrieves the specified metadata on the item.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. | |
GetType | (Inherited from Object.) | |
InitializeLifetimeService | Security Critical. When overridden in a derived class, gives task items infinite lease time.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. (Overrides MarshalByRefObject.InitializeLifetimeService.) | |
RemoveMetadata | Removes the specified metadata on the item.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. | |
SetMetadata | Sets or modifies the value of the specified metadata on the item.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. | |
ToString | Gets the item specification.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. (Overrides Object.ToString().) |
Top
Operators
Name | Description | |
---|---|---|
Explicit(TaskItem to String) | Allows an explicit type cast from a TaskItem to a String, and returns the ItemSpec for that item.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. |
Top
Explicit Interface Implementations
Name | Description | |
---|---|---|
ITaskItem2.CloneCustomMetadataEscaped | ITaskItem2 implementation which returns a clone of the metadata on this object. Values returned are in their original escaped form.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. | |
ITaskItem2.EvaluatedIncludeEscaped | ITaskItem2 implementation which gets or sets the item include value. For disk-based items this would be the file path.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. | |
ITaskItem2.GetMetadataValueEscaped | ITaskItem2 implementation which allows the values of metadata on the item to be queried.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. | |
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.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. |
Top
Remarks
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.
Thread Safety
Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.