Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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.

like image 944
Hoppe Avatar asked Nov 21 '14 21:11

Hoppe


People also ask

Is Bower a package manager?

Bower is a front-end package manager built by Twitter. Also known as a Package manager for the Web, bower is used in modern open source and closed source projects to solve many recurrent issues.

How do you add Bower components to a project?

To add a new Bower package to your project you use the install command. This should be passed the name of the package you wish to install. As well as using the package name, you can also install a package by specifying one of the following: A Git endpoint such as git://github.com/components/jquery.git.

How do I use Visual Studio package manager?

Open your project or solution in Visual Studio, and select Tools > NuGet Package Manager > Package Manager Console to open the Package Manager Console window. In the console, enter Find-Package with a keyword to find the package you want to install.

What is Bower in Visual Studio?

Bower is a “package manager for the web.” Bower lets you install and restore client-side packages, including JavaScript and CSS libraries. For example, with Bower you can install CSS files, fonts, client frameworks, and JavaScript libraries from external sources.


1 Answers

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 ....

like image 157
markwilde Avatar answered Oct 12 '22 20:10

markwilde