How to create first ASP.NET MVC application

141
create asp.net mvc application

How to create ASP.NET MVC web application

In this article, we will learn how to create a new asp.net mvc application from scratch using Visual Studio and understand the basic building blocks of the ASP.NET MVC web application.

First, need to setup a development environment to develop an ASP.NET MVC 5 application.

Setup Development Environment

You can develop ASP.NET MVC application with an appropriate version of Visual Studio and .NET framework, as you have seen in the previous article of mvc version history.

Here, we will use MVC v5.2, Visual Studio 2017 Community edition and .NET framework 4.6 to create our first MVC application.

You can download the latest version of Visual Studio from the following link: https://visualstudio.microsoft.com/downloads/

Create first simple MVC application

Open your Visual Studio 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 the 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 the Browse.. button. Finally, click OK.

Select template

Create MVC Project in Visual Studio

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

Create MVC App

Create an MVC Application

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 Authentication 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

First MVC Application

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

Run 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

Responsive MVC Application 2

Responsive MVC Application

So in this way, you can create your first MVC 5 application in Visual Studio 2013, 2015 for Web.

Conclusion

I hope you liked this article based on how to create asp.net mvc application. I would like to have feedback from my blog readers. Your valuable feedback, question, or comments about this article are always welcome.

LEAVE A REPLY

Please enter your comment!
Please enter your name here