次の方法で共有


ITaskFactory2.Initialize Method (String, IDictionary<String, String>, IDictionary<String, TaskPropertyInfo>, String, IBuildEngine)

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.

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 Initialize ( _
    taskName As String, _
    factoryIdentityParameters As IDictionary(Of String, String), _
    parameterGroup As IDictionary(Of String, TaskPropertyInfo), _
    taskBody As String, _
    taskFactoryLoggingHost As IBuildEngine _
) As Boolean
bool Initialize(
    string taskName,
    IDictionary<string, string> factoryIdentityParameters,
    IDictionary<string, TaskPropertyInfo> parameterGroup,
    string taskBody,
    IBuildEngine taskFactoryLoggingHost
)
bool Initialize(
    String^ taskName, 
    IDictionary<String^, String^>^ factoryIdentityParameters, 
    IDictionary<String^, TaskPropertyInfo^>^ parameterGroup, 
    String^ taskBody, 
    IBuildEngine^ taskFactoryLoggingHost
)
abstract Initialize : 
        taskName:string * 
        factoryIdentityParameters:IDictionary<string, string> * 
        parameterGroup:IDictionary<string, TaskPropertyInfo> * 
        taskBody:string * 
        taskFactoryLoggingHost:IBuildEngine -> bool
function Initialize(
    taskName : String, 
    factoryIdentityParameters : IDictionary<String, String>, 
    parameterGroup : IDictionary<String, TaskPropertyInfo>, 
    taskBody : String, 
    taskFactoryLoggingHost : IBuildEngine
) : boolean

Parameters

  • factoryIdentityParameters
    Type: 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.

Return Value

Type: System.Boolean
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.

.NET Framework Security

See Also

Reference

ITaskFactory2 Interface

Initialize Overload

Microsoft.Build.Framework Namespace