In part 1 I laid out the requirements of the application and went over a simple design for the basics of the application.
In this part I’m going to go over setting up the project ready to begin coding.
Installing ASP.NET MVC
If you haven’t done so all ready, you will need to install ASP.NET MVC, which the installer can be found here.
As you can tell, I’m using version 1.0 as 2.0 is still in pre-RTM state. Installing ASP.NET MVC is simple and follows your standard, next, next, next, finish setup wizard.
And as an added bonus, MVC also works with Visual Web Developer 2008 Express, which is the free edition of Visual Studio for ASP.NET web development, which can be found here.
Choosing a Unit Testing Framework
Choosing a unit testing framework is simply a personal choice. Microsoft have included their own with Visual Studio 2008 (not express editions unfortunately), called MSTest. However my personal favourite at the moment is MBUnit/Gallio which can be found here. Most testing framework are fairly similar so if you are using a different one you should easily be able to translate my tests to your framework of choice.
Creating the MVC Project
If you start a new project in Visual Studio 2008 (or Visual Web Developer 2008) and select the project type “Web” under either Visual C# or Visual Basic (I’ve gone for C# as it’s my language of choice) you should see a template called “ASP.NET MVC Web Application”. Select the template and enter a Name for your project.
As you can see, I’ve given my solution the name of the software, and my project name is my solution name with .Web appended, this is my naming convention. This also makes sure that the default namespace for anything in my Web project is ArtistShowcase.Web .
Clicking OK will bring us on to the next part of the Project setup wizard.

As you can see, it’s asking me if I want to create a new Unit Test project for my MVC web project. As I’m going to be writing unit tests, I’m going to select yes. You’ll also notice that MBUnit shows up in here. This is small bonus for using MBUnit. MSTest also shows up in the drop down box, as you would expect, since it is Microsoft’s testing framework.
One thing to be aware of, is that you may never see this dialog if your using Visual Web Developer 2008 Express, as it' doesn’t support Unit Testing. So if you are using the Express edition, you’ll have to create your own class library that references your testing framework and your web project inside your solution.
After clicking OK will be present with our new solution, complete with Web Project and Testing Project.
This is a default project, that actually already contains some stuff, so there are a handful of unit tests that you can run, you can even run the project and get greeted with the basic MVC website.
However, I don’t want the default, and as much as starting off from this point can speed our development up, I want to start from scratch and go through all the headaches :)
So I’ve emptied the Content, Controllers and Models folder. I’ve deleted everything the views folder except the Web.config and I’ve also deleted the controllers folder from my test dll.
My Solution Explorer now looks like this:
Wrapping up
Okay that’s it for setting up the project and we should be okay to start coding and that’s all for this post.In the next post I’m going to go over the MVC directory structure and basic fundamentals of MVC and hopefully we’ll get to write our first line of code.