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

巧了我就是萌 提交于 2019-12-10 12:46:32

问题


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.


回答1:


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.




回答2:


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



回答3:


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.




回答4:


[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.




回答5:


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




回答6:


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')



来源:https://stackoverflow.com/questions/28597838/visual-studio-task-runner-explorer-extension-does-not-recognize-gulpfile-js

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!