How to disable Visual Studio 2015 and above automatic bower install on solution load?
Asked Answered
F

5

30

Whenever I open the solution in Visual Studio 2015 or 2017 RC it starts automatically running bower install on one of the projects. The bower install output can be seen in the Bower/NPM output under the Output view:

PATH=X:\iis\wwwroot\LeExampleProjectName\.\node_modules\.bin;%PATH%
"C:\Users\PC118\AppData\Roaming\npm\Bower.cmd" install --force-latest
bower angular#1.3.14            cached git://github.com/angular/bower-angular.git#1.3.14
bower angular#1.3.14          validate 1.3.14 against git://github.com/angular/bower-angular.git#1.3.14
bower bootstrap#3.3.2           cached git://github.com/twbs/bootstrap.git#3.3.2
bower bootstrap#3.3.2         validate 3.3.2 against git://github.com/twbs/bootstrap.git#3.3.2
bower moment#~2.10.3            cached git://github.com/moment/moment.git#2.10.6
bower moment#~2.10.3          validate 2.10.6 against git://github.com/moment/moment.git#~2.10.3
bower angular-sanitize#1.3.14   cached git://github.com/angular/bower-angular-sanitize.git#1.3.14
bower angular-sanitize#1.3.14 validate 1.3.14 against git://github.com/angular/bower-angular-sanitize.git#1.3.14
bower lodash#3.3.1              cached git://github.com/lodash/lodash.git#3.3.1
bower lodash#3.3.1            validate 3.3.1 against git://github.com/lodash/lodash.git#3.3.1
bower angular-ui-select#~0.12.0 cached git://github.com/angular-ui/ui-select.git#0.12.1
bower angular-ui-select#~0.12.0         validate 0.12.1 against git://github.com/angular-ui/ui-select.git#~0.12.0
bower angular-animate#1.3.14              cached git://github.com/angular/bower-angular-animate.git#1.3.14
bower angular-animate#1.3.14            validate 1.3.14 against git://github.com/angular/bower-angular-animate.git#1.3.14
bower angular-strap#2.2.0                 cached git://github.com/mgcrea/angular-strap.git#2.2.0
bower angular-strap#2.2.0               validate 2.2.0 against git://github.com/mgcrea/angular-strap.git#2.2.0
bower selectize#0.8.5                     cached git://github.com/brianreavis/selectize.js.git#0.8.5
bower selectize#0.8.5                   validate 0.8.5 against git://github.com/brianreavis/selectize.js.git#0.8.5
bower microplugin#0.0.x                   cached git://github.com/brianreavis/microplugin.js.git#0.0.3
bower microplugin#0.0.x                 validate 0.0.3 against git://github.com/brianreavis/microplugin.js.git#0.0.x
bower jquery#>=0.6.0                      cached git://github.com/jquery/jquery.git#2.1.4
bower jquery#>=0.6.0                    validate 2.1.4 against git://github.com/jquery/jquery.git#>=0.6.0
bower sifter#0.3.x                        cached git://github.com/brianreavis/sifter.js.git#0.3.4
bower sifter#0.3.x                      validate 0.3.4 against git://github.com/brianreavis/sifter.js.git#0.3.x
bower jquery#>= 1.9.1                     cached git://github.com/jquery/jquery.git#2.1.4
bower jquery#>= 1.9.1                   validate 2.1.4 against git://github.com/jquery/jquery.git#>= 1.9.1
bower lodash#3.3.1                       install lodash#3.3.1
bower moment#~2.10.3                     install moment#2.10.6
bower angular-sanitize#1.3.14            install angular-sanitize#1.3.14
bower angular-ui-select#~0.12.0          install angular-ui-select#0.12.1
bower angular#1.3.14                     install angular#1.3.14
bower selectize#0.8.5                    install selectize#0.8.5
bower angular-animate#1.3.14             install angular-animate#1.3.14
bower microplugin#0.0.x                  install microplugin#0.0.3
bower sifter#0.3.x                       install sifter#0.3.4
bower angular-strap#2.2.0                install angular-strap#2.2.0
bower bootstrap#3.3.2                    install bootstrap#3.3.2
bower jquery#>= 1.9.1                    install jquery#2.1.4
lodash#3.3.1 bower_components\lodash
moment#2.10.6 bower_components\moment
angular-sanitize#1.3.14 bower_components\angular-sanitize
└── angular#1.3.14
angular-ui-select#0.12.1 bower_components\angular-ui-select
└── angular#1.3.14
angular#1.3.14 bower_components\angular
selectize#0.8.5 bower_components\selectize
├── jquery#2.1.4
├── microplugin#0.0.3
└── sifter#0.3.4
angular-animate#1.3.14 bower_components\angular-animate
└── angular#1.3.14
microplugin#0.0.3 bower_components\microplugin
sifter#0.3.4 bower_components\sifter
angular-strap#2.2.0 bower_components\angular-strap
└── angular#1.3.14
bootstrap#3.3.2 bower_components\bootstrap
└── jquery#2.1.4
jquery#2.1.4 bower_components\jquery

Is there a way to disable this automatic bower install? And other ways to configure it?

Finzer answered 12/8, 2015 at 12:35 Comment(4)
did you manage to fix this issue? Im also experiencing thisSuperstratum
@LincAbela I did not find any fix yet. I will post an answer if I find any but currently I am not actively looking for any solution.Jaggery
This is so freaking annoying - thanks @Razvan. ill also post answer here if I get a solution.Superstratum
Also looking for thisDeclarative
F
25

In VS 2017 and newer you can go to:

Tools -> Options -> Projects and Solutions -> Web Package Management -> Package Restore

And set to false the restores you do not want to happen on project open or save:

Finzer answered 6/2, 2017 at 9:30 Comment(1)
works on VS pro 2017(v15.3.4), a clean and clever answer ;)Lunette
R
19

It seems it is not possible to disable this for a specific solution or project, but here is how you can disable it globally:

  • In VS, go to Tools > Options > Projects and Solutions > External Web Tools
  • Disable all search paths, in my case there were four of them

Note that the output window may display some errors during solution loading. In my case it complained about gulp not being found. This has no negative effects, however.

All tools work as expected when called from the command line.

Ramsay answered 1/10, 2015 at 15:57 Comment(5)
Thank you. I removed only $(PATH) and it stopped running it on start.Jaggery
s/diaable them all/disable the ones which need to be disabledJaggery
This is the only work-around that I've found. Extremely disappointing that there is not a good solution in VS.Awhile
Now that your comments argon it looks like I am talking to myself. xDJaggery
In VS 2017 it's Tools > Options > Projects and Solutions > Web Package Management > External Web ToolsEveliaevelin
K
1

You can exclude the bower.json file from your Visual Studio project, but keep it in the project directory to manually run bower.

Kielty answered 21/2, 2017 at 20:10 Comment(2)
Interesting in my case since I used bower to download components to a shared directory where projects pick up files, rather than installing directly into project. Weird, maybe, but more adapted to how we work here.Famish
This is a great project-level solution. You don't have to change a global setting, and can also check in the change to source control, which might be preferable if you work in teams and on multiple projects.Cawnpore
G
0

In my own case (VS2015), I found a bogus package.json file in my project directory.

Removing the package.json file stopped bower from trying to run "npm install" every time I opened the project.

Gearbox answered 2/10, 2017 at 15:5 Comment(0)
M
0

Just posting a more up to date solution for this problem, in case someone stumbles upon this post...

Tools -> Options -> Projects and Solutions -> Web Package Management -> Package Restore

And then turn the appropriate settings to "False".

Multifold answered 18/6, 2019 at 7:5 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.