ASP.NET MVC 6 In Visual Studio 2017: Basics
Introduction
This article explains the basics of ASP.NET MVC 6 in Visual Studio 2017. Before learning about ASP.NET MVC 6 in Visual Studio 2017, install Visual Studio 2017 Community Edition, using the link given below to how to install step by step way.
MVC Versions
ASP.NET MVC has different versions. The diagram given below explains MVC versions. ASP.NET MVC Core 1.0 and is also called ASP.NET MVC 6.
Steps for ASP.NET MVC 6
ASP.NET MVC 6 is a platform, which is supported in cross platform. It will run Windows, Linux and Mac. The steps are given below to create simple ASP.NET MVC 6 in Visual Studio 2017.
Step 1
First, install Visual Studio 2017, using the step by step article in the link given below.
Now, open Visual Studio 2017 and go to File and select New Project.
Step 2
Select the Web under Visual C# in New Project Window and select ASP.NET Core Web Application (.NET Core) under the Web. Now, give the name of the project and click OK.
We can see the message “Project templates for creating ASP.NET Core Applications for Windows, Linux and MacOS, using .NET Core” on the right side after selecting ASP.NET Core Web Application (.NET Core) in New Project Window.
Step 3
Will be open New ASP.NET Core Web Application (.NET Core) Window after clicking OK button. We can choose ASP.NET Core version weather ASP.NET Core 1.0 or ASP.NET Core 1.1 looks, as shown below.
Now, select Web Application and click OK. In this template, we cannot find ASP.NET MVC template because MVC 6 or ASP.NET Core is a default MVC (Model-View-Controller) structure.
After opening an Application, we can see the first look, which looks as shown below. We can see three important menus on left side.
Connection Services
We can add code and dependencies for one of these Services to our Applications.
Publish
We can publish our app to Azure or any other host.
Step 4
Go to View in the menu and click Solution Explorer. Now, we can see Solution Explorer, which is on right of our screen. We can see many different names of the folders and files in Solution Explorer, compared to another version of MVC.
Dependencies are new in MVC Core 1.2 or MVC 6. It is like References. We can see the Reference at Solution Explorer in the previous version of MVC. If we want to add any new references, using dependencies can be added. We can see Bower, NuGet, SDK under Dependencies.
Properties are new in ASP.NET Core. It contains the launchSettings.json files. It contains default project setting, which looks, as shown below.
Controller and View folders are same as the previous version. There are no changes in controller and view folder.
The starting point of the Application is Main(). It is placed in Program.cs file. We can see the coding line, which looks, as shown below. Our Application uses Startup class and will be loaded. We can see about startup class given below.
Startup class is a very important part of ASP.NET MVC Core. Routing is mentioned in Startup.cs. It contains many methods and a constructor. Using Startup class, our Application will start, we can see Startup class in Program.cs file.
Step 5
Now, build and run the project.
Conclusion
This article explained the basics and overview of ASP.NET MVC Core or ASP.NET MVC 6 by following simple steps. It helps the new learners and a new user of Visual Studio 2017. Next part of the article will explain about the features of ASP.NET MVC Core features.