Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Visual Studio 2015 restore package in Bower does nothing

In Visual Studio 2015, I've added, for example, "angular" as a dependency in bower.json. When I go into Dependencies -> Bower I see angular in the list except it says not installed next to it. Right-clicking on Bower and clicking "Restore packages" removes the "not installed" next to angular, however I don't actually have any angular files added to my wwwroot. Am I missing an extra step here?

like image 579
girlcode Avatar asked Jan 26 '15 01:01

girlcode


2 Answers

Thomas is correct! I ran into the same problem and found that you need to use your Grunt File to run the Bower task. For example, right-click on your Grunt file and choose Task Runner Explorer

Task Runner Explorer

Next, right-click on the Bower task and Run.

Run bower

Once the task is finished running, you will notice the packages have been copied to your wwwroot.

like image 167
Deano Avatar answered Oct 19 '22 03:10

Deano


The package files are installed into a folder called "bower_components" in your project directory. The folder is hidden in the Visual Studio solution explorer. It's meant to be a cache of downloaded package files.

Typically you would setup grunt or gulp tasks to copy or process only the files you need from the package to somewhere under wwwroot.

For example if you install bootstrap using bower you might setup a task to compile and concat the LESS source files with your app's LESS files, or alternatively you might just setup a task to copy the pre-compiled .css files from the bower_components\bootstrap\dest folder.

This post shows how to use bower and grunt together. http://www.asp.net/vnext/overview/aspnet-vnext/grunt-and-bower-in-visual-studio-2015

like image 33
Thomas Kadlec Avatar answered Oct 19 '22 05:10

Thomas Kadlec