In this tutorial, we get started by building an ASP.NET Core Hello World example application. We will use Visual Studio 2017 as our editor. The application will use the default empty template, which displays “Hello World”. Before getting started, you must install the .NET Core SDK and Visual Studio 2017 Community Edition. We also learn how to build and run the Hello World App using the dotnet command-line utility.
Table of Contents
Build the ASP.NET Core Hello World 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 a few choices
Runtime
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 a Cross-platform web application
Choose .Net Core
Version of ASP.NET
The second option allows choosing the Version of ASP.NET. The dropdown will show all the installed versions of .NET core SDK. You can download the latest version of .NET Core SDK
Choose the latest version. Right now it is .NET Core 2.2
Project Template
Next, we need to choose the Project Template. There are several options here including Angular, ReactJs template.
Let us choose Empty here
Docker Support
The Docker support is added in Visual Studio 2017 allowing .NET Applications to run inside a Docker container.
Keep it unchecked
Authentication
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.
Configure for HTTPS
You can select this option if you wish to enforce HTTPS, which is a good thing to do, But for this tutorial let us keep it simple. Untick this option

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 without the IIS Express. This is similar to using dotnet run
from the command prompt as shown in the next section.
Running the App Using Dotnet Run
We can also run the program using the dotnet command-line utility
Open the command window and go to the project root folder. The root folder is where you will find the HelloWorld.csproj
file
And type the command dotnet run HelloWorld
The project runs and listens on port 5000

Output files
When we build the (F5 or Ctrl-F5), the project is compiled and compiled files are copied to the output folder, which is bin/<configuration>/<target>
.
The <configuration>
is the name of the build configuration used. It is either debug
for debug builds and release
for release builds.
The <target>
is “netcoreapp<.NetCoreVersion>”. Since we had chosen ASP.NET Core 2.2, the target folder becomes netcoreapp2.2
For a build using the debug configuration, the compiled files are copied to bin/debug/netcoreapp2.2
under the project directory.
Open the command prompt and cd into the output folder as shown below. Now, you can execute the program from here by using the command dotnet helloWorld.dll
The App will run and listen on the port 5000 & 5001. Open the browser and browse to the location http://localhost:5000
and you should see the “Hello World”.

Building the Project from the command line
We can also build the project from the command line using the dotnet CLI
Open the project and goto the solution root folder, where the .sln file is located and just run.
1 2 3 | dotnet build |

Summary
We learned how to create an ASP.NET Core Hello World using Visual Studio 2017. We learned how to run it under IIS Express. We also build and run it using dotnet cli.