How to create a MVC 2 Project in VS2010?

How to create a MVC 2 Project in VS2010?
1. Open VS2010.
2. Select File -> New Project.

New Project

New Project

3. Select Visual C# -> Web -> ASP.NET MVC 2 Empty Web Application. Name it as MyMvcApplication. Click ‘OK’.

Application Name

Application Name

4. To Add a controller, right click Controllers. Select Add -> Controller

Add Controller

Add Controller

5. Name the controller as ‘HomeController’. Click ‘Add’.

Name_HomeController

Name_HomeController

6. The controller page will look like shown below.

Page_HomeController

Page_HomeController

7. To Add the Index, right click on anywhere on the Index() method. Click ‘Add View’.

Add Index

Add Index

8. The below screen will be shown. Unselect ‘Select master page’ and click on ‘Add’.

Select Master Page

Select Master Page

9. The Index view will be added and will be shown as below.

Index View

Index View

10. Type the text “Hello! This is My MVC Application.” within the tags.

Type Text

Type Text

11. Press ‘F5’ to run the application. The browser will open as in screen below.

Sample Application

Sample Application

Leave a Reply

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

  1. thanks for the tutorial
    I am having a problem.
    The feature “Create SQL server database” isn’t available , I can’t select it.
    Can you help, please ?