ASP .NET 5 RC1 is out. This is a short tutorial on how you can include client packages in this new version and how Bower is integrated in Visual Studio 2015.
Here’s how to manage your client dependencies.
Before You Start
For those who have not idea of what is new I invite you to first understand the basics. Please, come back afterwards.
New in this Version
One of many new features in ASP .NET 5 is the addition of Bower. The good news is that you can easily understand it.
With Bower updates are faster. Every time a new version or update is released we can easily find it in Bower. You no longer have to wait as we had to with NuGet.
Another huge advantage is that with Bower we can find a lot more libraries. With NuGet the number of libraries was limited because it was used by .NET developers mostly. With Bower every frontend developer can contribute their libraries.
So we could say that NuGet continues to be the king in the server side, but Bower is the new king of client-land.
How to Configure with Bower
Alright, now let’s go ahead and prove it. In this example I’ll use Visual Studio 2015 with ASP .NET 5 RC1.
- Create an empty project (i.e., don’t use a template)
- Add the
bower.jsonfile and the
.bowerrcfile will be added automatically
- In your project, select
> Add > New item… >
- In the client-side section, select the Bower Configuration File
bower.jsonwe just type the name of the package that we want to add. Notice autocomplete helps you by suggesting versions. Nice!
- Save the changes and a folder named
libwill be immediately generated in
wwwrootwith the requested package. In this case JQuery is needed so Bower adds it as well. Wonderful!
- In the section
Dependenciesyou can see what you have through Bower including its version and dependencies in a direct way.
Adding Bower configuration file
bower.json in Project
lib folder is named by default but you can name it whatever you want later. You can do this in the
The rest is the same, just include the name of your package and save changes.
New folder Display
And Then …
It’s that simple. You can now easily add client-side packages and enjoy the variety automagically. Updates are immediate.