9

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.

rism
  • 11,221
  • 14
  • 70
  • 110
pQuestions123
  • 4,053
  • 5
  • 24
  • 51
  • I am having the same problem. Did you figured it out? – Hudvoy Mar 12 '15 at 19:16
  • 1
    @Hudvoy yeah, restart VS – pQuestions123 Mar 12 '15 at 19:34
  • Having the same problem. I copied my client application containing gulpfile.js into an existing Visual Studio Project which is part of a larger solution, and I don't see the option to open Task Runner Explorer when I right click the gulpfile.js file. I've restarted VS numerous times after trying various changes and can't get it to work. I also noticed that when I go to View -> Other Windows -> Task Runner Explorer, the window opens, but the Projects Dropdown is empty. – Anil Natha Jun 01 '15 at 17:31
  • Make sure the the gulp file is named gulpfile.js. Later versions of VS do not include gulpfile as an option in the "Add New" function. Manually adding the file can lead to name irregularities. At least it did with me. Just once. 10 minutes ago. 2 hours down the drain. :( – PiggyMacPigPig Jun 07 '19 at 15:16

6 Answers6

6

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.

rism
  • 11,221
  • 14
  • 70
  • 110
3

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
John Weisz
  • 23,615
  • 9
  • 74
  • 118
  • 1
    Thanks this helped me access the task runner window in visual studio when I right-click on my gulpfile.js! – gurkan Feb 10 '17 at 14:36
1

For me the problem was that gulpfile.js was in the Script folder and not in the root of the project. After moving it and restart VS, it worked.

1

[I am not positive about this solution but it sounds plausible for my case.]

If you have "Lightweight solution load" activated, expand the web project.

TL;DR

My fresh VS2017 did not show anything in the Task runner explorer. But when I expanded the web project Task runner explorer was populated and gulp files run.
I have "Lightweight solution load" activated and the web project was not loaded before I expanded it.

LosManos
  • 6,117
  • 5
  • 44
  • 81
0

I was just having the same issue. I had to update the Task Runner Explorer and restart VS.

Sean
  • 315
  • 5
  • 11
0

as stated on the extension site

Known issues

These are known issues that we plan to solve soon:

Only web projects are supported Projects inside nested solution folders aren't supported yet

you need to make sure your project type is 'web site' (I can confirm the same gulpfile.js loaded ok on a 'web site' but did not on a 'web application')

Edu M
  • 554
  • 5
  • 21