In this tutorial I will show you how to: download and install the .NET SDK, create a C# project, run your C# project, and edit your code.

Download and install the .NET SDK

In order to write software applications using C# you’ll need to have the .NET SDK installed.

At the time I am writing this article, .NET 5 is the current version. You’ll need to download the .NET SDK and choose the version of the .NET SDK that is correct for your operating system. Once the installation package has finished downloading, run it to install the .NET SDK.

Once everything is installed, open a new terminal window and run this command:

[code lang=”console”]
dotnet
[/code]

If you see an error saying ‘dotnet’ is not recognized as an internal or external command then something went wrong. Try restarting your computer and following these steps again. If you didn’t see any errors, you should be ready to go!

Create your project

Open a new terminal window. In your terminal window, run these commands to create your project:

[code lang=”console”]
dotnet new console -o HelloWorld
[/code]

The dotnet new console command creates a new console project for you.

The -o parameter creates a directory called HelloWorld where your project is stored and populates it with the required files.

Now, navigate to the new directory created using the previous command:

[code lang=”console”]
cd HelloWorld
[/code]

The cd HellowWorld command changes your current directory to the one just created for the new project.

Run your code

Edit your code

Leave a Reply

I’m Peter

I’ve spent my career building software and leading engineering teams. I started as a developer and architect, grew into engineering leadership, and today I serve as a Chief Technology Officer.

Here, I share practical insights on technology, leadership, and building high-performing teams.

Connect with me on LinkedIn.

Discover more from Peter Mourfield

Subscribe now to keep reading and get access to the full archive.

Continue reading