Create a .NET 4 MVC 3 Web Site or Migrate MVC 2 to 3

In earlier posts, I explained the move from Silverlight 3 to 4. Now I want to explain the move from MVC 2 to 3. You need to upgrade, as one day we may well be on MVC 13, and you won’t want your site still running on MVC 2. Besides, MVC 3 has the new HTML Razor engine. Yeah!

In Part I, I briefly explain how to make the small jump from MVC 2 to 3.

In Part II, I give steps for creating an MVC 3 /Razor enabled web site from scratch.

Part I — Move from MVC 2 to 3

Step 1: Install MVC 3

To Install MVC 3, download it here: http://www.asp.net/mvc/mvc3

Step 2: Convert your existing project

To do this, use the automatic conversion tool found here:
http://aspnet.codeplex.com/releases/view/59008

This tool successfully converted my Web.config and Views\Web.config files.

That’s it, the conversion is that easy.

Part II — Creating an MVC Site from Scratch

An MVC 3 site which uses the Razor engine (as opposed to WebForms) is quite compelling, and is the engine of choice (as I understand it). To use this technology, you’ll need to spend three or four hours reading and implementing tutorials.

Step 1: Watch the Tutorials

This multiple part tutorial will get you going with a .NET 4 web site, MVC 3 and Razor. You can use the free Visual Studio browser to build your site, but you will need to purchase space on a .NET 4 compatible server (Discount ASP.NET is a good choice).

Part 1 of 9.

Step 2: Prepare your target server to receive your site

So, you have built your web site, and you want to get your public server ready to serve it up to the world. The exact steps you need to take to do this are dependent upon your particular brand of server, but what you will need to do looks something like what you see at Discount ASP.NET.

You will want to read my earlier article on Silverlight to see how to prepare your server for .NET apps.

Step 3: Deploy

MVC 3 is new, so your server may need some help recognizing your project files. Namely, add the following references to your project and for each one, go to the properties and set Copy Local to true (my source of information).

System.Web.Mvc

Microsoft.Web.Infrastructure

System.Web.Razor

System.Web.WebPages

System.Web.WebPages.Razor

System.Web.Helpers

System.Web.WebPages.Deployment

Conclusion

Programming dynamic web sites is getting a lot easier, and the .NET 4 framework with MVC 3 and the Razor engine is proof. These technologies represent hundreds of man-years (thousands maybe), which have been invested to build and perfect a truly reusable platform.

3 thoughts on “Create a .NET 4 MVC 3 Web Site or Migrate MVC 2 to 3

  1. Brian… I mean Sam Smith… you know this is a technology blog, right? And your IP address was logged, along with your service provider…? …yeah, smooth comment.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>