Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Visual Studio Task Runner Explorer Extension does not recognize gulpfile.js

I am trying to use the VS Task Runner Explorer to run gulp as a step during the build.

Here are the steps I took: 1) Downloaded node.js 2) ran: npm install gulp -g from the command line 3) downloaded and installed task runner 4) closed and reopened visual studio

I can now access the task runner window in visual studio but when I right click on my gulpfile.js, there is no option to open it in the task runner explorer.

All help is appreciated, thanks in advance.

like image 943
pQuestions123 Avatar asked Feb 19 '15 02:02

pQuestions123


People also ask

How do I run Gulpfile in Visual Studio?

Run a Gulp Task in Visual Studio CodeType "Run Task" and select it, which will bring up a list of tasks configured in Gulp. Choose the Gulp Task you want to run! Most of your Gulp Tasks will probably be automated using gulp watch, but manual Gulp Tasks can easily be run within Visual Studio Code.

How do I set up task runner in Visual Studio?

Configuring Visual Studio Task Runner to Execute A Task When the Project is Opened. If you have never used or opened the built in task runner it is simple, press Alt + Shift + Backspace or select it from the other windows list from the View menu. You should see the task runner window at the bottom of Visual Studio.


2 Answers

I've found it doesn't work if you have the project in a Solution Folder. Move the project out of the solution folder and it is instantly recognized. Move it back and it disappears again.

Note that by Solution Folder I mean the virtual folders we create in Visual Studio to organize larger projects, as per the link above, not whatever folder you happen to plunk your project into on the file system.

So it's obviously a lookup problem/oversight with respect to the .sln file.

like image 174
rism Avatar answered Oct 08 '22 15:10

rism


This is some enigmatic issue in VS that also happens with chutzpah. After 2 coffees and hours of raging rampage and pulling my hair, these are the steps that always seem to solve the issue (at least for me, in VS 2015):

For each developer machine

  1. Install nodejs
  2. npm install gulp -g
  3. npm install gulp-cli -g

For each project

  1. From the project root folder run npm install gulp --save-dev
  2. Create and configure gulpfile.js in the project's root as you need, make sure it is included with the project
  3. Restart Visual Studio

Every time you add/remove tasks from gulpfile.js, restart Visual Studio. This seems to cut it for me with all project types.


Additional tips if the above doesn't work:

  • after creating gulpfile.js but before restarting VS, run gulp <taskname> from project root, make sure it runs without errors
  • run Visual Studio as administrator
like image 31
John Weisz Avatar answered Oct 08 '22 15:10

John Weisz