MVC4 – Empty Project Template

This is my first post on Exploring MVC 4 Templates. & i will start with “Empty Project Template”

In Visual Studio 2010 . Create a new ASP.NET MVC4 Project.  Select “Empty” from given list of Templates & click OK.

EmptyProjectTemplate

This should create a project for you with following defaults.

EmptyProjectDefaults

An Empty MVC project provides the minimum set of resources & references to run MVC4 application. Notice that we have no files under Controllers, Views & Models. Project disk size is less than 12 MB.

Hit F5 key to run your application.

Get surprised to see an error page , telling that “The resource cannot be found.” This is because the ASP.Net engine expects a Controller & a View Object.

To make your project work, add a controller to your project.

AddController

Notice that we have selected “Empty MVC Controller” Template.

Now we need to add a View Object in our solution.

AddView

We will keep our View file under Home folder

SlnExplorer

Now if we hit F5, we should be able to see a page without any errors.

Advertisements

One comment on “MVC4 – Empty Project Template

  1. Pingback: MVC4 – Basic Project Template | Sarfraz Ahmed's Blog

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s