How to configure gulp to work the same in Visual Studio 2017 and msbuild without the need to change build scripts?

I am trying to configure using gulp in Visual Studio 2017. I am not sure where I am going wrong, but there are some things that I am confused about and I cannot find their online resources that can be used.

The build system I use is CruiseControl.NET, and I would like gulp to work with it.

This is what I have done so far:

  • Installed Visual Studio 2017 with .NET Core cross-platform developmentand Node.js developmentselected (among other options).

  • New project created

  • gulpfile.jsFile added to project

  • Right-click on the file and select Task Runner Explorer

In the Runner Task Explorer, I get an error Failed to load. See output window (Ctl+Alt+O) for more information..

Then if I do the following:

  • Open the Node.js Interactive Window

  • Run the command .npm install --global gulp-cli

  • Visual Studio .

(No tasks found).

-, gulp Visual Studio 2017?

, , , , (.. .npm npm).

, gulp, C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\Web\External\node_modules.

- CruiseControl.NET.

+9
3

Microsoft , gulp: https://docs.microsoft.com/en-us/aspnet/core/client-side/using-gulp

, Visual Studio 2017 , Node.js, NPM Gulp ( " Node.js" Visual Studio, ).

npm (package.json) gulp:

{
  "version": "1.0.0",
  "name": "example",
  "private": true,
  "devDependencies": {
    "gulp": "3.9.1"
  },
  "scripts": {
    "gulp": "gulp"
  }
}

Gulp (gulpfile.js), .

, gulp:

cd $(ProjectDir)
call dotnet restore
npm run gulp

Visual Studio 2017, (""> " "> " ").

Node.js , , , , !

+6

, , - -Essentials 2017. Bundler Minifier, bundleconfig.json. , Bundler Minifier, Gulp.

gulp gulpfile.js, npm, Gulp. , npm , gulpfile.js, Gulp - . , gulpfile.js , npm ( VS 2017). , , .

, gulp, , , , .

Microsoft Docs, " ". Gulp, .

https://docs.microsoft.com/en-us/aspnet/core/client-side/bundling-and-minification

+8

I found a solution here . More information about this part of VS from Mads himself .

You must force Visual Studio to run with your version of Node.js:

Go to Tools> Optionsin Visual Studio 2017

Go to Projects and Solutions>External Web Tools

Add the following path: C:\Program Files\nodejs

enter image description here

+1
source

Source: https://habr.com/ru/post/1016276/


All Articles