Task runners in Visual Studio 2015

Mads

January 6th, 2016

There are various kinds of tasks typically used by web developers as part of their workflow. Everything from bundling and minifying JavaScript files, to compiling LESS files into CSS and even running custom batch or PowerShell scripts.

In a sense you can say that tasks are steps that needs to be performed to make the application run that are separate from coding it.

Visual Studio 2015 supports any kind of custom task execution from the new Task Runner Explorer tool window. It ships with built-in support for two very popular web centric task runners – Grunt and Gulp.

The Task Runner Explorer shows a list of available tasks and executing them is as simple as a click of the mouse. You can even bind any task to specific events that occur in Visual Studio such as Build, Clean and Project Open.

Sure you can use the command line to invoke your custom tasks, but with the integration into Visual Studio you can automate a lot more of your workflow.

There are quite a few extensions freely available that adds support for a lot more task frameworks.

NPM Scripts Task Runner

This task runner adds support for npm scripts listed in the scripts section of a package.json file. This allows you to run any executable with any arguments simply by modifying package.json.

You can read more about npm scripts and how to set it up in the npm documentation.

Download | Source code

Command Task Runner

Is similar to the NPM Script Task Runner in that it can execute any executable, but with the main difference that you don’t need a package.json file. Also, this extension supports inline PowerShell and batch commands.

This make it perfect for any type of project that has custom .cmd or .ps1 files as part of the build process.

Download | Source code

WebPack Task Runner

From the webpack website: webpack is a bundler for modules. The main purpose is to bundle JavaScript files for usage in a browser, yet it is also capable of transforming, bundling, or packaging just about any resource or asset.

Webpack is getting more and more popular and seems to be resonating very well with React.js developers.

Download | Source code

Broccoli Task Runner

From the Broccoli is a build tool that is very popular with developers using the ember.js JavaScript framework, but can be used in any web project.

From their website: A fast, reliable asset pipeline, supporting constant-time rebuilds and compact build definitions. Comparable to the Rails asset pipeline in scope, though it runs on Node and is backend-agnostic.

Download | Source code

Brunch Task Runner

Brunch is a builder. Not a generic task runner, but a specialized tool focusing on the production of a small number of deployment-ready files from a large number of heterogeneous development files or trees.

Download | Source code

ASP.NET 5 Task Runner

Allows you to easily execute the scripts in project.json’s scripts section such as prepublish and postbuild. But you can also specify your own custom scripts that this extension can then execute.

This makes it possible to setup a full build process from a single location.

Download | Source code

All of these extensions demonstrate just how flexible the Task Runner Explorer in Visual Studio is. If you find your favorite task runner framework to be missing from this list, please let us know in the comments.