I've just created my first ASP.NET 5 MVC 6 project in VS 2015. The web application project that comes out of the box.
I figured out that bower components are stored in wwwroot/lib
folder. I made an experiment and deleted it. After that I rebuilt the project and the bower components were not restored.
Calling bower install
manually in console restored the files.
How do I make Visual Studio restore bower files automatically on build?
I figured out a way to do this, though I don't really like it. I'll be happy to accept a better answer.
In project's gulpfile.js the first line is a comment"
It hooks to Visual Studio
Clean
event and bindsclean
Gulp task to it. You can hook to other events e.g.After Build
. I bound it with a task that uses gulp-bower to restore the components.gulpfile.js
You can see the bindings in
Task Runner Explorer
:This solution seems kind of clumsy though. I'd rather have the kpm-utility do the job.
EDIT
Actually there is no need for restoring the packages on build. They are restored when you open the project in VS. However I don't know what happens when you update your sources from code repository.