Compartilhar via


ITaskFactory2.CreateTask Method

Definition

Create an instance of the task to be used, with an optional set of "special" parameters set on the individual task invocation using the MSBuildRuntime and MSBuildArchitecture default task parameters. MSBuild provides an implementation of this interface, TaskHostFactory, that uses "MSBuildRuntime", with values "CLR2", "CLR4", "CurrentRuntime", and "" (Any); and "MSBuildArchitecture", with values "x86", "x64", "CurrentArchitecture", and "" (Any). An implementer of ITaskFactory2 can choose to use these pre-defined MSBuildRuntime and MSBuildArchitecture values, or can specify new values for these parameters.

public:
 Microsoft::Build::Framework::ITask ^ CreateTask(Microsoft::Build::Framework::IBuildEngine ^ taskFactoryLoggingHost, System::Collections::Generic::IDictionary<System::String ^, System::String ^> ^ taskIdentityParameters);
public Microsoft.Build.Framework.ITask CreateTask (Microsoft.Build.Framework.IBuildEngine taskFactoryLoggingHost, System.Collections.Generic.IDictionary<string,string> taskIdentityParameters);
abstract member CreateTask : Microsoft.Build.Framework.IBuildEngine * System.Collections.Generic.IDictionary<string, string> -> Microsoft.Build.Framework.ITask
Public Function CreateTask (taskFactoryLoggingHost As IBuildEngine, taskIdentityParameters As IDictionary(Of String, String)) As ITask

Parameters

taskFactoryLoggingHost
IBuildEngine

The task factory logging host will log messages in the context of the task.

taskIdentityParameters
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 to the task invocation itself, via e.g. the special MSBuildRuntime and MSBuildArchitecture parameters.

Returns

The generated task, or null if the task failed to be created.

Remarks

If a task factory implements ITaskFactory2, MSBuild will call this method instead of ITaskFactory.CreateTask.

Applies to