A Mutable Log

A blog by Devendra Tewari


Project maintained by tewarid Hosted on GitHub Pages — Theme by mattgraham

Hello World with .NET Core

.NET Core is Microsoft’s new cross-platform Command Language Runtime (CLR). This post is an elementary getting started guide where I create, build and run a “Hello World!” console application with .NET Core.

Let’s begin by downloading and installing .NET Core for your platform.

To create a new console application, run

mkdir project
cd project
dotnet new console

That will create two files - project.csproj and Program.cs. Edit Program.cs using your favorite editor.

I recommend using the multi-platform VS Code. You can extend the capabilities of VS Code by downloading extensions from the VisualStudio Marketplace. VS Code should prompt you to download the C# extension when you open Program.cs.

To build the new program from the command line run

dotnet build

To execute the program run

dotnet run

You can also edit, and run or debug the program using VS Code, as shown in this screenshot

.NET CLR with VS Code

Console applications can be very powerful, but .NET CLR can also be used to build Web applications using ASP.NET Core.