本文介绍了如何在Visual Studio 2013中将Bower用作程序包管理器? IE.我有一个.NET项目,想使用Bower添加一些软件包的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在Visual Studio 2013中将Bower用作程序包管理器? IE.我有一个.NET项目,想要使用Bower添加一些软件包.

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.

我阅读了斯科特·汉塞尔曼(Scott Hanselman)的帖子,但目前尚不清楚.我安装了插件.我是否使用包管理器控制台?我是否可以将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?

我的项目已经有一个package.json.

My project already has a package.json.

如果我打开VS命令窗口并键入bower,则会收到消息:命令"bower"无效.

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

推荐答案

如果我是对的,则任务浏览器仅在此处自动为您构建任务,并带有咕unt声.获取NPM,Bower和Grunt都是您需要通过命令行为项目执行的手动步骤.从Hanselmans博客安装内容之后,您必须开始为项目安装NPM,然后通过NPM添加凉亭和咕unt声.请执行以下操作:

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:

  • 打开命令行并导航到您的项目文件夹(我的文件夹位于c:\ dev \ WebProject1)
  • 在命令行上运行:npm init并填写问题(名称,说明等)
  • 您现在可以安装Bower.通过nuget npm install bower -g
  • 安装Bower .
  • 并为您的项目初始化Bower(仍在命令行中),键入:bower init输入并填写您的项目默认值
  • 最后安装您的软件包并添加以下文字:bower install angular --save
  • 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

完成此操作后,您可以在Visual Studio中包含生成的文件(package.json和bower.json),并将文件链接到index.html页面

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>

Visual Studio工具仅可用于在Visual Studio中编辑bower.json和package.json.然后,您只需运行bower install即可安装新的或更改的软件包

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

如果您随后要自动化一些构建任务,则可以从grunt开始以自动化一些东西.参考:从Grunt开始

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

我遇到了约翰·帕帕(John Papa)的这篇文章.让您轻而易举地启动并运行 John Papa:使用NodeJS启动并运行. ...

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

这篇关于如何在Visual Studio 2013中将Bower用作程序包管理器? IE.我有一个.NET项目,想使用Bower添加一些软件包的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-24 00:17