HI WELCOME TO SIRIS

Create First ASP.NET MVC Application

Leave a Comment
In this section, we will create a new MVC 5 application with Visual Studio 2013 for Web and understand the basic building blocks of a MVC Application.
First of all, setup a development environment to develop an ASP.NET MVC 5 application.

Setup Development Environment

You can develop ASP.NET MVC application with appropriate version of Visual Studio and .NET framework, as you have seen in the previous section of 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.
Download the latest version of Visual Studio from https://visualstudio.microsoft.com/downloads.

Create first simple MVC application

First of all, open a Visual Studio 2017 Community edition and select File menu -> New -> Projectas shown below.
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 any appropriate name for your application). Also, you can change the location of the MVC application by clicking on Browse.. button. Finally, click OK.
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 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.
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 default template as shown below.
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 home page in the browser as shown below.
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, top menu bar will be changed in the mobile devices as shown below.
Responsive MVC Application
Responsive MVC Application

So in this way, you can create your first MVC 5 application using Visual Studio 2013 for Web.
Learn about ASP.NET MVC folder structure in the next section.

0 comments:

Post a Comment

Note: only a member of this blog may post a comment.