In this tutorial, we will teach how to build a basic ASP.NET Core web application using Visual Studio 2017. The application will use the default empty template, which displays “Hello World”.
In this article
Creating the App
Open Visual Studio 2017. You need Version 15.3.4 or higher. If you do not have it, then please head over to Installing and setting up ASP.NET Core development environment Tutorial for the installation instruction.
Click on Open -> File -> New -> Project
Choose the ASP.NET Core Web Application template. This Template is available under Visual C# -> .NET Core option
Name the project as HelloWorld.
Once you click ok, you are taken to New ASP.NET Core Web Application Dialog Box
Here you have to make few choice
The First Dropdown displays the Runtime. It has two options .NET Core & .NET Framework.
The .NET Framework is an older framework with the rich full set of features but limited to Windows OS Only.
The second option is the new .NET Core, which allows you to build Cross-platform web application
Choose .Net Core
Version of ASP.NET
The second option allows choosing the Version of ASP.NET. We have three options Version 1.0, 1.1 & 2.0
Choose .NET Core 2.0
Next, we need to choose the Project Template. There are several options here including Angular, ReactJs template.
Let us choose Empty here
The Docker support is added in Visual Studio 2017 allowing .NET Applications run inside a Docker container.
Keep it unchecked
We can set up individual, work or school, or windows authentication using this option. For Empty Template, the only option available is No Authentication.
Click ok to create the Project. The Visual Studio creates the project with minimum settings required to start building ASP.NET Core web application.
Running the App
Hit F5 to run the app. You will see “Hello World” in the browser
Hitting F5 starts the application in debug mode. The debug mode allows you to make changes to the application, while it is running.
You can also choose Ctrl-F5, which starts the application in non-debug mode.
Running the App in IIS Express
Visual Studio starts IIS Express and runs your app. It chooses a random port number to start your application
The IIS Express icon appears at the bottom right-hand side in the taskbar as shown in the image below.
Running the App in dotnet CLI
By default Visual Studio starts the IIS Express to run your application. You can change this from IIS Express to HelloWorld (or name of the Project) from the standard toolbar
Change it to HelloWorld and hit F5. The Application will now run under Dotnet CLI.
You can also open the project folder ( folder which contains HelloWorld.csproj ) and run the dotnet run to get the similar result
We learned how to create an ASP.NET Core application in Visual Studio. We learned how to run it under IIS Express or run it using dotnet cli.