Share via


ITaskFactory2.Initialize Method

Definition

Initializes this factory for instantiating tasks with a particular inline task block and a set of UsingTask parameters. MSBuild provides an implementation of this interface, TaskHostFactory, that uses "Runtime", with values "CLR2", "CLR4", "CurrentRuntime", and "" (Any); and "Architecture", with values "x86", "x64", "CurrentArchitecture", and "" (Any). An implementer of ITaskFactory2 can choose to use these pre-defined Runtime and Architecture values, or can specify new values for these parameters.

public:
 bool Initialize(System::String ^ taskName, System::Collections::Generic::IDictionary<System::String ^, System::String ^> ^ factoryIdentityParameters, System::Collections::Generic::IDictionary<System::String ^, Microsoft::Build::Framework::TaskPropertyInfo ^> ^ parameterGroup, System::String ^ taskBody, Microsoft::Build::Framework::IBuildEngine ^ taskFactoryLoggingHost);
public bool Initialize (string taskName, System.Collections.Generic.IDictionary<string,string> factoryIdentityParameters, System.Collections.Generic.IDictionary<string,Microsoft.Build.Framework.TaskPropertyInfo> parameterGroup, string taskBody, Microsoft.Build.Framework.IBuildEngine taskFactoryLoggingHost);
abstract member Initialize : string * System.Collections.Generic.IDictionary<string, string> * System.Collections.Generic.IDictionary<string, Microsoft.Build.Framework.TaskPropertyInfo> * string * Microsoft.Build.Framework.IBuildEngine -> bool
Public Function Initialize (taskName As String, factoryIdentityParameters As IDictionary(Of String, String), parameterGroup As IDictionary(Of String, TaskPropertyInfo), taskBody As String, taskFactoryLoggingHost As IBuildEngine) As Boolean

Parameters

taskName
String

Name of the task.

factoryIdentityParameters
IDictionary<String,String>

Special parameters that the task factory can use to modify how it executes tasks, such as Runtime and Architecture. The key is the name of the parameter and the value is the parameter's value. This is the set of parameters that was set on the UsingTask using e.g. the UsingTask Runtime and Architecture parameters.

parameterGroup
IDictionary<String,TaskPropertyInfo>

The parameter group.

taskBody
String

The task body.

taskFactoryLoggingHost
IBuildEngine

The task factory logging host.

Returns

A value indicating whether initialization was successful.

Remarks

MSBuild engine will call this to initialize the factory. This should initialize the factory enough so that the factory can be asked whether or not task names can be created by the factory. If a task factory implements ITaskFactory2, this Initialize method will be called in place of ITaskFactory.Initialize.

The taskFactoryLoggingHost will log messages in the context of the target where the task is first used.

Applies to