Dela via


HostServices.GetHostObject Method

Gets the host service for the given task where the task appears within a target and project with the given names.

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.Execution
Assembly:  Microsoft.Build (in Microsoft.Build.dll)

Syntax

'Declaration
Public Function GetHostObject ( _
    projectFile As String, _
    targetName As String, _
    taskName As String _
) As ITaskHost
public ITaskHost GetHostObject(
    string projectFile,
    string targetName,
    string taskName
)
public:
ITaskHost^ GetHostObject(
    String^ projectFile, 
    String^ targetName, 
    String^ taskName
)
member GetHostObject : 
        projectFile:string * 
        targetName:string * 
        taskName:string -> ITaskHost
public function GetHostObject(
    projectFile : String, 
    targetName : String, 
    taskName : String
) : ITaskHost

Parameters

  • taskName
    Type: System.String

    The task name associated with the host service.

Return Value

Type: Microsoft.Build.Framework.ITaskHost
Returns the host service for the given task where the task appears within a target and project with the given names. If no host service exists, returns null.

.NET Framework Security

See Also

Reference

HostServices Class

Microsoft.Build.Execution Namespace