Partager via


Exec.ExecuteTool Method

This API supports the .NET Framework infrastructure and is not intended to be used directly from your code.

Executes the cmd.exe tool, waits for its completion, and cleans up the batch file after execution completes.

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

Syntax

'Declaration
Protected Overrides Function ExecuteTool ( _
    pathToTool As String, _
    responseFileCommands As String, _
    commandLineCommands As String _
) As Integer
protected override int ExecuteTool(
    string pathToTool,
    string responseFileCommands,
    string commandLineCommands
)
protected:
virtual int ExecuteTool(
    String^ pathToTool, 
    String^ responseFileCommands, 
    String^ commandLineCommands
) override
abstract ExecuteTool : 
        pathToTool:string * 
        responseFileCommands:string * 
        commandLineCommands:string -> int  
override ExecuteTool : 
        pathToTool:string * 
        responseFileCommands:string * 
        commandLineCommands:string -> int
protected override function ExecuteTool(
    pathToTool : String, 
    responseFileCommands : String, 
    commandLineCommands : String
) : int

Parameters

  • pathToTool
    Type: System.String

    The path to the tool to execute.

  • responseFileCommands
    Type: System.String

    Command line arguments that should go into a temporary response file.

  • commandLineCommands
    Type: System.String

    Command line arguments that should be passed to the tool directly.

Return Value

Type: System.Int32
The exit code that the tool returns.

Remarks

If errors were logged and the tool has an exit code of zero, then this method sets the exit code to -1.

.NET Framework Security

See Also

Reference

Exec Class

Microsoft.Build.Tasks Namespace