First install the .NET Core SDK by going through the installation instructions for the platform of your choice:
After the installation has completed, open a command prompt, or terminal window.
mkdir hello_world
and change into the newly created directory with cd hello_world
.dotnet new console
.This will produce two files:
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp1.1</TargetFramework>
</PropertyGroup>
</Project>
Program.cs
using System;
namespace hello_world
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("Hello World!");
}
}
}
dotnet restore
.dotnet build
for Debug or dotnet build -c Release
for Release. dotnet run
will also run the compiler and throw build errors, if any are found.dotnet run
for Debug or dotnet run .\\bin\\Release\\netcoreapp1.1\\hello_world.dll
for Release.