VS2017 Task Runner Explorer 未找到任务 [英] VS2017 Task Runner Explorer No Tasks Found

查看:46
本文介绍了VS2017 Task Runner Explorer 未找到任务的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在 VS 2017 的 MVC Core 项目中设置 gulp.我拥有我认为有效的 gulpfile.js:

I'm trying to set up gulp in an MVC Core project within VS 2017. I have what I believe to be a valid gulpfile.js:

var gulp = require('gulp');
var rimraf = require('rimraf');
var concat = require('gulp-concat');
var cssmin = require('gulp-cssmin');
var uglify = require( 'gulp-uglify' );

var paths = {
    webroot: './wwwroot/',
};

paths.js = paths.webroot + 'js/**/*.js';
paths.minJs = paths.webroot + 'js/**/*.min.js';
paths.css = paths.webroot + 'css/**/*.css';
paths.minCss = paths.webroot + 'css/**/*.min.css';
paths.concatJsDest = paths.webroot + "js/site.min.js";
paths.concatCssDest = paths.webroot + "css/site.min.css";

gulp.task("clean:js", function (cb) {
    rimraf(paths.concatJsDest, cb);
});

gulp.task("clean:css", function (cb) {
    rimraf(paths.concatCssDest, cb);
});

gulp.task( "clean", ["clean:js", "clean:css"] );

但是当我打开 Task Runner Explorer 时,我收到消息(未找到任务)".

But when I open Task Runner Explorer I get the message "(no tasks found)".

我已经检查以确保所有 gulp 软件包都是通过 npm 安装的.我还添加了一个 package.json 文件.但是仍然没有找到任务.

I've checked to ensure all the gulp packages were installed via npm. I also added a package.json file. But the tasks are still not being found.

我做错了什么?

推荐答案

显然,您必须在项目中本地安装 gulp 才能使其与 Visual Studio 正常工作.全局安装不起作用.删除全局副本并在本地安装即可解决问题.

Apparently you have to install gulp locally within your project for it to work properly with Visual Studio. Global install won't work. Deleting the global copy and installing it locally solved the problem.

这篇关于VS2017 Task Runner Explorer 未找到任务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆