What's In the Box with ASP.NET MVC 4?
There are a few new things that come with new projects build in ASP.NET MVC 4 along with the ones we are used to by now. These tools that you get are delivered via NuGet packages, so let's look at the packages that we already had in ASP.NET MVC 3 that are still in the box in ASP.NET MVC 4 preview.
If I do a new ASP.NET MVC 3 package, I get the following that are still in ASP.NET MVC 4 preview (the versions below reflect what are in MVC 4 preview):
- jQuery UI (Combined Library 1.8.11) - jQuery UI is a themeable user interface widget collection that is built on jQuery. There are a lot of widgets in jQuery UI and this NuGet package contains all of them. On the website for jQuery UI you can download a script that only has the widgets in it that you want, which is the best option for using this package because smaller client-side assets mean faster download. This is a good package to start with though, so no need to replace it if you are just messing around.
- jQuery Validation (1.8) - This is a validation plugin built on jQuery. It's nice and easy to use. You can find some documentation on how to use it on the jQuery website, though most people using ASP.NET MVC probably use the unobtrusive validation plugin mentioned below.
- Entity Framework (4.1) - Need an object-relational mapper (ORM)? One is included in the box. EF 4.1 is the code-first version, which allows you to avoid the dorky designer approach to configuring your ORM. I've generally found it easy to use.
The following were in MVC 3 (with different versions in some cases) but not as NuGet packages:
- jQuery Unobtrusive Validation (1.0) - This is a helper library that helps you setup and use the jQuery Validation plugin. How does it help, you ask? Well, if you use the data annotation attributes on your view models and use the helpers in ASP.NET MVC to build your forms, you'll get the validations implied by the attributes applied automagically to your fields via data-* attributes. Of course this is just the client-side piece of that.
- ASP.NET Web Pages 2 Core Libraries (2.0.1 Developer Preview) - Bits of ASP.NET MVC (noteably Razor...not sure what else) are built on the Web Pages libraries, which are core for Web Matrix. These are the preview versions of version 2.
- ASP.NET MVC 4 (4.0.1 Developer Preview) - The developer preview of ASP.NET MVC 4...you know, that thing you are trying out. This is the core library of ASP.NET MVC.
Those lists may not be the same as a clean install but reflect what I have on my machine now. Here are the new NuGet packages added for ASP.NET MVC 4 Preview:
- ASP.NET Universal Providers - Remember the providers that have been in ASP.NET for a while, like Session, Membership, Profile and Role? These are new provider libraries for these things that support a wider range of data stores (apparently include support for Sql Compact Edition and Azure). For a more interesting and complete look at this, you can read more about these providers on Scott Hanselman's blog.
- ASP.NET Optimization - Bundling (0.1) - This one is new and there doesn't appear to be much information on it on the web. However, you can watch this presentation from Build that showed quite extensively how to use it or this post by Tore Lervik on optimizing without drawbacks. If you are watching the Ruby on Rails world, this may look familiar as it sure looks a lot like the Rails 3.1 asset pipeline. But copying in this case is definitely for ASP.NET's benefit.
So that is what is in the box. The one that I am most interested in is the optimization library. I will definitely be messing with that soon.
But I Don't Want That!
If there is a package that you don't want, you can delete it from your solution, packages file and packages directory manually or (a much better option) you can use NuGet to do that. In the image above, you will see that the selected package has a "Manage" button. Click on that. You will get a dialog that looks like this:
Deselect the project or solution that you want it removed for a voila, it removes everything for you. Sweet.