How can I use Bower as a package manager with Visual Studio 2013? I.e. I have a .NET project and want to add some packages uses Bower

可紊 提交于 2019-12-10 04:58:02

问题


How can I use Bower as a package manager with Visual Studio 2013? I.e. I have a .NET project and want to add some packages uses Bower.

I read Scott Hanselman's post, but it's not clear. I installed the plugins. Do I use the package manager console? Do I add bower as a package source?

My project already has a package.json.

If I open the VS command window and type bower, I receive the message: Command "bower" is not valid.


回答1:


If I am correct, the task explorer is only there to automate build tasks for you, combined with grunt. Getting NPM, Bower and Grunt are all manual steps you need to do for your project via the command line. After you installed the stuff from Hanselmans blog, you have to start with installing NPM for your project, then you add bower and grunt via NPM. DO the following:

  • Open a command line and navigate to your project folder (mine is located in c:\dev\WebProject1)
  • on the command line run: npm init and fill out the questions (name, description etc.)
  • You are now ready to install bower. Install bower via nuget: npm install bower -g
  • and initialize bower for your project (still in the command line), type: bower init enter and fill out your project defaults
  • finally install your package with bower: bower install angular --save

When that's done, you can include the generated files in visual studio (package.json and bower.json) and link the files in your index.html page

<script src="/bower_components/angular/angular.js"></script>

The visual studio tools are only ment to edit the bower.json and package.json within visual studio. You then only have to run bower install to install new or changed packages

If you then want to automate some build tasks you can start with grunt to automate some stuff. Ref:start with Grunt

edit 1: I came across this post from John Papa. Gets you up and running in a breeze John Papa: Up and running with NodeJS ....



来源:https://stackoverflow.com/questions/27070362/how-can-i-use-bower-as-a-package-manager-with-visual-studio-2013-i-e-i-have-a

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