In this tutorial, I will show you how to create a new ASP.NET Core 2.0 web application using visual studio 2017. This application will show you a simple statement “Hello, Congratulation you have created your first ASP.NET Core application using visual studio 2017”. This is very easy and interesting.
In the previous tutorial, I have shown some key features of asp.net core. If you don’t know “what are the features of ASP.NET Core”, then go to the previous tutorial.
Create First ASP.NET Core web application
Let’s see how to create a new project in ASP.NET Core using visual studio 2017. Now follow these below steps.
Step # 1 – Open visual studio 2017 => click on file => New => Project.
Step # 2 – From the left pane, go to visual C# under the installed template, then choose web (Installed => Visual C# => Web). Then choose “ASP.NET Core Web Application” from the middle pane. Then enter the project name (E.g. FirstAspNetCoreApp) in the name field.
Note: – Name should be without spaces.
Then if you want to change the path of your application, then choose the path by clicking the Browse button. And finally, click on the ok button. Then it will show a popup window for starting ASP.NET Core application.
Here in the middle pane, you will see two different web templates for web projects. One is “ASP.NET Core Web Application” and the other one is “ASP.NET Web Application (.NET Framework)”. Check the difference below.
ASP.NET Core Web Application: This will start you with a cross-platform compatible project that runs on the .NET Core framework.
ASP.NET Web Application (.NET Framework): This starts a new project that runs on the standard .NET Framework on windows.
Step # 3 – Then select the Empty option and then just simply click on the OK button.
Here you will see I am using an empty template, it’s because I want to build this application from scratch.
Now, it will create a simple project without creating any content within it.
Step # 4 – Run your application by pressing Ctrl + f5 or by going to debug menu Debug => Start without debugging. Then you will see “Hello World” statement in your browser.
Step # 5 – Change the hello world statement into “Hello, Congratulation you have created your first ASP.NET Core application using visual studio 2017”. Let’s see how we can do it. Go to Solution Explorer => open “Startup.cs” file. And then replace “Hello World” statement with the above one.
Now run your application again by pressing Ctrl + f5. And you will see your browser will show a statement “Hello, Congratulation you have created your first ASP.NET Core application using visual studio 2017”.