Visual Studio 2012 and the Asp.Net refresh (2012.2) have introduced a number of new and refreshed templates to help bootstrap your project as you turn up a new MVC 4 site. This post breaks down the key items that are in each of the templates to help you get a better understanding of your starting point.
The template names are across the top, and the items included in the template in the leftmost column.
|Controllers, Models, Views, App_Start, App_Data||X||X||X||X||X|
|Global.asax, Web.Config, Packages.Config||X||X||X||X||X|
|FilterConfig, RouteConfig, WebApiConfig||X||X||X||X||X|
|_ViewStart, _Layout and Error Pages||X||X||X||X|
|Sample Home Controller & Views||X||X||X|
|Notable Third-Party Features|
|jQuery, jQuery UI||X||X||X||X|
|KnockoutJS, Modernizer, Validation||X||X||X||X|
|Authentication and Authorization|
|Models, EF DbContext Samples||X||X|
|Supporting “Simple” Provider & ActionFilter||X||X|
|Support for External OAuth||X||X|
|Auth via Active Directory (Azure or Windows)||X|
Taking a look at the templates from a more pragmatic perspective, let’s consider how you’d actually use them and the situations where they’d be most appealing.
- Empty – This is the barebones project with enough of the MVC bits wired so that you can work on the Asp.Net stack. If you are looking for a clean slate, this is it. You can leverage the conventions of the framework, choose your client-side libraries, build your own templates, and create your controllers and views from scratch.
- Basic – If you’re good with the default selection of scripts and templates – jQuery and jQuery UI are installed for you – the rest of the pieces are in place for you to pick up and start developing. This project type adds a basic template (your layout page) and an error page with no styling. There’s more of a canvas here, with a little less legwork than the empty template.
- Intranet – The biggest differentiator for this template from the Internet version is the absence of accounts and authorization. Instead, the project ships with a read me with links on how to configure Active Directory and integrated sign on. This is especially great if you’re working with Azure and corporate accounts where users have IE installed – you get single sign-on to the app.
- Mobile – While all the template types support alternate views which could be used for mobile support, this project comes ready to target mobile browsers. I won’t get into the debate of responsive design vs. dedicated sites here, but certainly if you are trying to create a context-centric, mobile-specific experience, this is the easiest place to start.
There are notably three project types missing from the mix: Single Page Application, Web API and the newly introduced Facebook Application. These each a have specific function in the web development world and are worth considering individually; I’ll break them down in another post.
While I’ve spelled out the features of MVC projects that are included in each of the templates, I want to also say that if there is something that you would like included in a template that doesn’t have it by default, it’s still pretty easy to add most in. Many of the items above can be added with a right-click –> “New Something…” or by installing a package via NuGet.
All that’s left now to do is to poke around with the templates. Download Visual Studio 2012 from the Asp.Net MVC homepage to get all the bits you need to start building sites. You can get the template refresh from the vNext site. Finally, push through some of the tutorials and get an idea of what you can do with the MVC Framework!
Diving deeper? Try these: