Tasks can be started and restarted any time. Non-terminating tasks, like "watch" tasks, can be started multiple times and will run in parallel, unless terminated. One way to start a task is to double click on it in the list. There is also a "run" command in the context menu.
![Task context menu with the "run" command]()
Terminating a task
I had this same question today, but for other reasons. Apparently closing the associated console window terminates the task.
![Task Runner prompt to terminate a process]()
I remember in some older version of Visual Studio I had to open Task Runner Explorer manually, otherwise the tasks would not start.
Regarding syntax errors
To save yourself from the trouble of restarting a task, add some type of error handling. There are probably more solutions to this, but I used this one. Here's a shorter version:
const gulp = require('gulp');
const plumber = require('gulp-plumber');
const lessCompiler = require('gulp-less');
const lessFiles = 'Styles/**/*.less';
const compileLessTaskName = 'compile-Less';
gulp.task(compileLessTaskName, function () {
return gulp.src(lessFiles)
// Calling plumber at the start of the pipeline. In case of error, this stops
// the task without killing the whole process.
.pipe(plumber(function (error) {
console.log(error.message);
this.emit('end');
}))
.pipe(lessCompiler())
.pipe(gulp.dest('wwwroot/css'));
});
gulp.task('watch', function (asyncCallback) {
gulp.watch(lessFiles, [compileLessTaskName]);
asyncCallback();
});