Create ASP.NET MVC Application

In this section, we will create a new MVC web application using Visual Studio and understand the basic building blocks of the ASP.NET MVC Application.

We are going to use ASP.NET MVC v5.2, and Visual Studio 2017 community edition, and .NET Framework 4.6 to create our first MVC application.

Download the latest version of Visual Studio from visualstudio.microsoft.com/downloads.

Open Visual Studio 2017 and select File menu -> New -> Project, as shown below.

Create MVC Application
Create a New Project in Visual Studio

From the New Project dialog as shown below, expand Visual C# node and select Web in the left pane, and then select ASP.NET Web Application (.NET Framework) in the middle pane. Enter the name of your project MyMVCApplication. (You can give an appropriate name for your application). Also, you can change the location of the MVC application by clicking on Browse.. button. Finally, click OK.

Select template

From the New ASP.NET Web Application dialog, select MVC (if not selected already) as shown below.

Create MVC App
Select MVC Project Template

You can also change the authentication by clicking on Change Authentication button. You can select appropriate authentication mode for your application, as shown below.

Create simple MVC Application
Select Authenctication Type

Here, we are keeping the default authentication for our application which is No Authentication. Click OK to continue.

Wait for some time till Visual Studio creates a simple MVC project using the default template, as shown below.

MVC Application
MVC Project in Visual Studio

Now, press F5 to run the project in debug mode or Ctrl + F5 to run the project without debugging. It will open the home page in the browser, as shown below.

Run MVC Application
ASP.NET MVC Application

MVC 5 project includes JavaScript and CSS files of bootstrap 3.0 by default. So you can create responsive web pages. This responsive UI will change its look and feel based on the screen size of the different devices. For example, the top menu bar will be changed in the mobile devices, as shown below.

Responsive MVC Application 1
Responsive MVC Application

In this way, you can create your ASP.NET MVC 5 application using Visual Studio 2017.

Learn about ASP.NET MVC project's folder structure in the next section.

Want to check how much you know ASP.NET MVC?