每当我在Visual Studio 2015或2017 RC中打开解决方案时,它就会开始在其中一个项目上自动运行bower install。可以在输出视图下的Bower/NPM
输出中看到凉亭安装输出:
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
有没有办法禁用这种自动凉亭安装?还有其他配置方法吗?
答案 0 :(得分:20)
在VS 2017中,您可以访问:
Tools -> Options -> Projects and Solutions -> Web Package Management -> Package Restore
并设置为false,您不希望在项目打开或保存时进行恢复:
答案 1 :(得分:18)
似乎无法针对特定解决方案或项目禁用此功能,但这里如何全局禁用:
请注意,输出窗口可能会在解决方案加载期间显示一些错误。在我的情况下,它抱怨gulp
没有找到。然而,这没有负面影响。
从命令行调用时,所有工具都按预期工作。
答案 2 :(得分:1)
您可以从Visual Studio项目中排除bower.json文件,但将其保存在项目目录中以手动运行bower。
答案 3 :(得分:0)
在我自己的情况下(VS2015),我在项目目录中发现了一个伪造的 package.json 文件。
删除 package.json 文件阻止了bower尝试运行" npm install"每次我打开这个项目。
答案 4 :(得分:0)
只是发布有关该问题的最新解决方案,以防有人偶然发现此帖子...
工具->选项->项目和解决方案-> Web软件包管理->软件包还原
然后将适当的设置设为“ False”。