Hello World: ASP.NET First MVC Application using Visual Studio 2017

Hey Guys!

In this blog, we are going to see how we can create an ASP.NET MVC application using Visual Studio 2017.

Enough of talking, let’s jump into action.

Steps to be followed:

STEP 1:  Open Visual Studio 2017. From the Visual Studio menu, select File –> New –> Project.

STEP 2: Select the template Web and choose ASP.NET Web Application(.NET Framework). Give an appropriate name for your project and choose the destination of your project. Click OK.

STEP 3: There will be a popup available in which you have to select Empty template and click OK.

After clicking Ok, a new MVC web application has been added to your solution. So now we are going to create a folder called Controller and we will add a controller called HelloController.

STEP 4: Right click on the project and Select Add and choose New Folder and name it as Controllers.

STEP 5: Right click on the Controller folder and Select Add and choose Controller. There will be a popup available in which you have to select MVC 5 Controller – Empty and Click Add.

After clicking Add, mention the proper Controller name and then Click Add again. There will be some additional folders added to your solution.

STEP 6: Now we will add View for this respective controller. For adding the view open the respective controller, right click on the Index function and Select Add View.

STEP 7: Specify the View name and uncheck the Checkbox Use a layout page and Click Add.

STEP 8: After clicking Add, you will find a view under Views/{Controller name}/Index.cshtml. It’s just like HTML file where I’m just going to display a simple message.

I have added a message called “Hello World! This is my first MVC application”.

STEP 9: Then go to App_Start folder where you can find RouteConfig.cs file. Add the controller name as mentioned in the below image.

That’s it. Now Build the application(Ctrl+shift+B) and run by pressing F5.

OUTPUT:

Conclusion

That’s it, Guys. In our next blog, we will see how we can efficiently do CRUD operations in ASP.NET MVC application.

Download the source code using the below link: https://github.com/SuhasParameshwara/ASP.NET-First-MVC-Application

Gain Knowledge, Share Knowledge!

Happy Coding!

Cheers! 🙂

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

Blog at WordPress.com.

Up ↑

%d bloggers like this: