Lingua

TaskItem.RegisterTaskParameterValueType<T> Method

Definition

Registers a value 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 : value class static void RegisterTaskParameterValueType();
public static void RegisterTaskParameterValueType<T>() where T : struct;
static member RegisterTaskParameterValueType : unit -> unit (requires 'T : struct)
Public Shared Sub RegisterTaskParameterValueType(Of T As Structure) ()

Type Parameters

T

The value type to register. Enums and user-defined structs are permitted. The type and its array form (T[]) both become resolvable, and the type is rooted so a trimmer preserves it.

Remarks

The MSBuild intrinsic value types (Boolean, Int32, DateTime, and so on), String, and the MSBuild ITaskItem types are already registered; call this only for an additional value 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