Partager via


ITaskFactory2.CreateTask Method (IBuildEngine, IDictionary<String, String>)

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.

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.

Namespace:  Microsoft.Build.Framework
Assembly:  Microsoft.Build.Framework (in Microsoft.Build.Framework.dll)

Syntax

'Declaration
Function CreateTask ( _
    taskFactoryLoggingHost As IBuildEngine, _
    taskIdentityParameters As IDictionary(Of String, String) _
) As ITask
ITask CreateTask(
    IBuildEngine taskFactoryLoggingHost,
    IDictionary<string, string> taskIdentityParameters
)
ITask^ CreateTask(
    IBuildEngine^ taskFactoryLoggingHost, 
    IDictionary<String^, String^>^ taskIdentityParameters
)
abstract CreateTask : 
        taskFactoryLoggingHost:IBuildEngine * 
        taskIdentityParameters:IDictionary<string, string> -> ITask
function CreateTask(
    taskFactoryLoggingHost : IBuildEngine, 
    taskIdentityParameters : IDictionary<String, String>
) : ITask

Parameters

  • taskIdentityParameters
    Type: IDictionary<String, String>

    Special parameters that the task factory can use to modify how it executes tasks, such as Runtime and Architecture.

Return Value

Type: Microsoft.Build.Framework.ITask
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.

.NET Framework Security

See Also

Reference

ITaskFactory2 Interface

CreateTask Overload

Microsoft.Build.Framework Namespace