【问题标题】:Visual Studio Update 2 - Task Runner Explorer - Project OpenVisual Studio 更新 2 - 任务运行器资源管理器 - 项目打开
【发布时间】:2016-05-24 14:13:56
【问题描述】:

我正在尝试获取一个 gulp 监视任务(在保存时编译 TypeScript 文件)以使用 ProjectOpened 绑定运行 - 但它只是在项目打开时不会启动。

如果我在 Task Runner Explorer 中手动启动它,它工作正常。

我正在使用 ASP.NET Core 项目 (RC2),是否有任何 nuget 包或设置必须存在才能让项目打开的 gulp 任务运行?

或者调试它为什么不启动的方法?


package.json:

{
    "version": "1.0.0",
    "name": "demo-website",
    "private": true,
    "devDependencies": {
        "gulp": "3.9.1",
        "gulp-merge": "0.1.1",
        "gulp-sourcemaps": "1.6.0",
        "gulp-typescript": "2.13.4",
        "jspm": "0.16.34",
        "typescript": "1.8.10",
        "typings": "^1.0.4"
    },
    "dependencies": { },
    "jspm": {
        "directories": {
            "baseURL": "wwwroot"
        },
        "dependencies": {
            "bootstrap": "github:twbs/bootstrap@^3.3.6",
            "css": "github:systemjs/plugin-css@^0.1.21"
        },
        "devDependencies": { }
    }
}

gulpfile.js:

/// <binding BeforeBuild='ts-compile' ProjectOpened='watch-files' />

var gulp = require("gulp"),
    ts = require("gulp-typescript"),
    merge = require("gulp-merge"),
    sourcemaps = require("gulp-sourcemaps");

var webroot = "./wwwroot/";

var paths = {
    tsSource: "./TypeScript/**/*.ts",
    tsOutput: webroot + "compiled/"
};

var tsConfig = ts.createProject("tsconfig.json");

gulp.task("default", function () {
    // place code for your default task here
});

gulp.task("ts-compile", function () {
    return gulp.src([paths.tsSource, "./typings/index.d.ts"])
        .pipe(sourcemaps.init())
        .pipe(ts(tsConfig))
        .pipe(sourcemaps.write())
        .pipe(gulp.dest(paths.tsOutput));
});

gulp.task("watch-files", function () {
    gulp.watch(paths.tsSource, ["ts-compile"]);
});

【问题讨论】:

  • 你能分享你的gulfile.jspackage.json吗?

标签: visual-studio-2015 gulp asp.net-core task-runner-explorer


【解决方案1】:

这似乎是 RC2 的工具错误(工具预览 1)。看起来它将在 Preview 2 中修复。

https://github.com/aspnet/Tooling/issues/516

【讨论】:

  • 似乎是这样,但如果你先打开 Visual Studio,然后从 Visual Studio 中打开项目,它似乎可以工作。
  • 是的,我也看到了同样的情况。在修复之前,这是一个不错的解决方法。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多