ASP.NET 5 beta 8 is out. Yes, that’s a lot of betas, but it’s important to get things right when you’re doing something new like this. You can find instructions in our documentation for installing ASP.NET 5 beta8 on Windows, Mac and Linux.
While this is convenient change and great to starters, at some point you’ll want to graduate to a more formal process and want to move your bower client libraries back out, and then setup a task to move in just a files you want. Let’s take a moment and switch it back the way it was.
Update your .bowerrc and project.json
In the root of your project is a .bowerrc file. It looks like this:
Change it to something like this, and delete your actual wwwroot/lib folder.
Exclude your source bower folder from your project.json
You’ll also want to go into your project.json file for ASP.NET 5 and make sure that your source bower_components folder is excluded from the project and any packing and publishing process.
Update your gulpfile.js
var paths =
webroot: "./" + project.webroot + "/",
lib: "./" + project.webroot + "/lib/"
Add a copy task to your Gulpfile
Now open your Gulpfile and note all the tasks. You’re going to add a copy task to copy in just the files you want for deployment with your web app.
Here is an example copy task:
gulp.task("copy", ["clean"], function ()
var bower =
for (var destinationDir in bower)
gulp.src(paths.bower + bower[destinationDir])
.pipe(gulp.dest(paths.lib + destinationDir));
Do note this is a very simple and very explicit copy tasks. Others might just copy more or less, or even use a globbing wildcard. It’s up to you. The point is, if you don’t like a behavior in ASP.NET 5 or in the general build flow of your web application you have more power than ever before.
Right click the Bower node in the Solution Explorer and “Restore Packages.” You can also do this in the command line or just let it happen at build time.
Looking in this simplified screenshot, you can see the bower dependencies that come down into the ~/bower_components folder. Just the parts I want are moved into the ~/wwwroot/lib/** folder when the gulpfile runs the copy task.
Feel free to share in the comments links to your blog posts on how YOU like your gulpfiles and build process to work!
Sponsor: Thanks to Infragistics for sponsoring the feed this week! Responsive web design on any browser, any platform and any device with Infragistics jQuery/HTML5 Controls. Get super-charged performance with the world’s fastest HTML5 Grid – Download for free now!