Setting Up .NET
Installing the .NET SDK and getting comfortable with the dotnet CLI before writing any C#.
2 min read
Before writing a line of C#, you need the .NET SDK — the toolkit that includes the compiler, runtime, and the dotnet command-line tool used to create, build, and run projects.
Installing the SDK
Download the SDK (not just the runtime) from dotnet.microsoft.com. The SDK includes the runtime plus everything needed to build projects; the runtime alone only lets you run apps someone else already built. Once installed, confirm it worked:
dotnet --versionThat should print something like 8.0.100. If it doesn't, the SDK isn't on your PATH and you'll need to restart your terminal or reinstall.
The dotnet CLI
Almost everything you do with C# day-to-day goes through the dotnet command:
dotnet new console -o HelloWorld # scaffold a new console project
dotnet run # build and run the current project
dotnet build # build without running
dotnet add package Newtonsoft.Json # add a NuGet package dependencydotnet new supports many project templates beyond console — webapi, mvc, and classlib among them — which you'll use later in this course when building ASP.NET Core apps.
Understanding the project file
Every .NET project has a .csproj file describing how it's built:
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
</Project>TargetFramework pins which version of .NET the project compiles against. ImplicitUsings and Nullable are modern conveniences you'll meet properly in later lessons — for now, just know this file is the C# equivalent of package.json: it lists your target platform and dependencies, and you rarely need to hand-edit it beyond what the CLI generates.
Choosing an editor
Visual Studio Code with the C# Dev Kit extension is a lightweight, cross-platform option that works well for this course. Visual Studio (Windows-only, full IDE) and JetBrains Rider (cross-platform, paid) are the two heavier alternatives if you want more built-in tooling later. Any of the three will do for now — what matters is that dotnet run works from your terminal.
Test what you just learned
4 quick questions. Get all of them right to unlock the next lesson.
You can take the quiz without an account — logging in just lets your result count toward your progress.