Build your first .NET Core application using Visual Studio 2017

How to build your first Hello World! .NET Core application using Visual Studio 2017.

This article is a step by step guideline to write your very first basic Hello World! .NET Core app using Visual Studio 2017. 

Step 1. Download and Install Visual Studio 2017.

Download and install Visual Studio 2017 from the following URL. The current version of Visual Studio 2017 is RC.

Download website: https://www.visualstudio.com/

Note: If you do not have a Visual Studio 2017 license, download Visual Studio Community 2017. Visual Studio Community 2017 is a free, fully-featured IDE for students, open-source and individual developers
 

Step 2. Install .NET Core

Visual Studio 2017 already ships with .NET Core workload. On the Installation Workloads screens that you will see during the installation, make sure you select "NET Core and Docker (Preview)". See below.

 
 
This will install .NET Core support to Visual Studio 2017 development.

Step 3. Create a project 

Open Visual Studio 2017 and create a new project by selecting New > Project. You will see .NET Core in the left side of templates and in the right side, you will see various .NET Core templates as listed in the following image.

 

Select the Console App (.NET Core), give your project a name, select a correct folder, and click OK. This will create your first, Hello World! .NET Core project.

The default program has a Program.cs file that has code that is listed in the following code snippet. Keep in mind, the Console.ReadKey(); is the code I added after the file was already created.

  1. using System;  
  2.   
  3. class Program    
  4. {  
  5.   
  6. static void Main(string[] args)    
  7. {    
  8.   Console.WriteLine("Hello World!");    
  9.   Console.ReadKey();    
  10. }    
  11. }  

 

Step 3. Build and run

Build and run your project by hitting F5 or Fn+F5.

The output looks like the following figure.

 

Congratulations! You just built and ran your very first .NET Core.