The Task Runner Explorer addin provides a Task Runner Explorer window, similar to the one in Visual Studio on Windows, which can be used to run tasks with Cake, Gulp, Grunt, NPM and TypeScript.
- Task Runner Explorer Window
- View tasks
- Run tasks
- View task output
- Run and cancel long running tasks, such as tcs watch
- Configure tasks to run when specific IDE events occur
- Before Build
- After Build
- Project Opened
- Solution Opened
- Task Runners
- Visual Studio Mac 7.5 or later.
Task Runner Explorer
To open the Task Runner Explorer window, from the View menu select Pads, then select Task Runner Explorer.
The Task Runner Explorer will look for files supported by a task runner in the solution directory and the project directory. It will also look at all files that have been added to a project or that have been added to a solution folder.
The top left of the Task Runner Explorer shows a list of projects or the solution that have tasks available. This can be used to filter the tasks shown in the Task Runner Explorer window.
Currently changes made to tasks will not be detected automatically. To refresh the task information you can click the Refresh button available at the top left of the Task Runner Explorer window.
Running a Task
To run a task you can double click it or right click and select Run.
Output from the task is shown on the right hand side of the Task Runner Explorer window.
A long running task, such as tcs watch, will run until the solution is closed, or the Stop button, available on the right hand side of the Task Runner Explorer window, is clicked.
Binding Tasks to IDE Events
Tasks can be configured to run when the following IDE events occur:
- After Build
- Before Build
- Project or Solution Opened
If the task runner file is in a project directory then the build and clean events are associated with the project. If the task runner file is in a solution directory then the build events are associated with the solution.
To configure a task, right click it, select Bindings and then select the event.
The binding will be displayed in the Bindings tab and will also be shown as checked when the context menu for the task is opened.
To remove the binding you can right click the task, select Bindings and select the event again to uncheck it. Alternatively you can right click it in the Bindings tab and select Remove.
The order in which the tasks are run for a particular IDE event can be changed by right clicking the binding in the Bindings tab and selecting Move Up or Move Down.
The binding information is typically saved in a file in the same directory as the corresponding task runner file, however this depends on how the task runner is implemented.
Disabling Automatic Running of Tasks
In preferences there is a Task Runner Explorer section which shows a check box that can be used to enable or disable the automatic running of tasks on opening a project or solution, and when building or cleaning.
Cake Task Runner
The Cake task runner supports running tasks defined in a build.cake file.
This is based on the Cake Task Runner for Visual Studio.
Gulp Task Runner
The Gulp task runner supports running tasks defined in a gulpfile.js file.
Gulp needs to be installed separately.
Grunt Task Runner
The Grunt task runner supports running tasks defined in a Gruntfile.js file.
Grunt needs to be installed separately.
NPM Task Runner
The NPM task runner supports running tasks defined in a package.json file.
The NPM task runner supports running with the verbose NPM option defined. If a
task is selected then a button will be displayed on the left hand side of the
Task Runner Explorer window. If this is selected then npm will be passed the
-d argument when it is run.
NPM needs to be installed separately.
TypeScript Task Runner
The TypeScript task runner supports running tcs build and tcs watch if a tsconfig.json file is found.
The TypeScript task runner will try to use tsc that is distributed with the Web Tools extension that is included in Visual Studio for Mac. If the Web Tools extension is not installed then the task runner will fall back to running tsc directly.
There are two addins to be installed:
The Task Runner is the main addin. This will be used by other task runner addins and provides the main task runner API and services.
The Task Runners Bundle addin contains the Cake, Gulp, Grunt, NPM and TypeScript task runners. These are currently included together as a single addin instead of being distributed separately.
Download both of the above .mpack files. Install the Task Runner addin first since the Task Runners Bundle addin depends on it. To install an addin’s .mpack file, open the Extensions Manager by selecting Extensions… from the main menu. Click the Install from file button. Select the .mpack file and then click the Open button. After installing both the addins restart Visual Studio for Mac.
These addins are not currently available from the main Visual Studio for Mac extensions server.