Lingua

TaskItem.RegisterTaskParameterItemType<T> Method

Definition

Registers an ITaskItem type so it can be used as a task parameter type (the ParameterType of a <UsingTask><ParameterGroup> parameter) in a trimmed or Native AOT host, where resolving the type from its declared name by reflection is unavailable.

public:
generic <typename T>
 where T : Microsoft::Build::Framework::ITaskItem static void RegisterTaskParameterItemType();
public static void RegisterTaskParameterItemType<T>() where T : Microsoft.Build.Framework.ITaskItem;
static member RegisterTaskParameterItemType : unit -> unit (requires 'T :> Microsoft.Build.Framework.ITaskItem)
Public Shared Sub RegisterTaskParameterItemType(Of T As ITaskItem) ()

Type Parameters

T

The ITaskItem type to register. The type and its array form (T[]) both become resolvable. Item-typed parameters are validated by assignability, not member-reflected, so the type reference alone is preserved (no member rooting is required).

Remarks

The MSBuild ITaskItem types are already registered; call this only for an additional item type a host uses as a task parameter type.

Intended to be called once per type during host initialization, before the first project is evaluated. This method is thread-safe and idempotent.

Applies to