Setting Up .NET
Before writing any C#, you need the .NET SDK (Software Development Kit) installed on your machine. The SDK bundles the C# compiler (Roslyn), the .NET runtime, and the dotnet command-line interface (CLI) — the single tool used to create, build, test, run, and publish .NET projects. Unlike some languages that require separate installs for compiler, package manager, and runtime, .NET ships all of this as one cohesive toolchain that works identically on Windows, macOS, and Linux.
Cricket analogy: The .NET SDK is like an all-in-one cricket academy membership that bundles coaching, a fitness program, and a booking app into one package, rather than needing separate memberships at three different facilities across countries.
Installing the SDK
You can install the .NET SDK from the official dotnet.microsoft.com downloads page, via a package manager (winget on Windows, brew on macOS, apt/dnf on Linux), or inside a container image for CI/CD pipelines. Once installed, running dotnet --version in a terminal confirms the SDK is on your PATH and reports which version is active. It's common to have multiple SDK versions installed side by side (e.g., .NET 6 LTS and .NET 8 LTS); a global.json file can pin a specific SDK version for a given project or repository.
Cricket analogy: Installing gear via the local sporting goods store, an online retailer, or a club supplier all get you the same certified bat; checking the maker's stamp confirms which model you have, and a squad's official equipment memo can pin the exact bat generation required for a specific tournament.
Choosing an Editor
Visual Studio (Windows, full IDE with rich designers and debugging), Visual Studio Code (free, cross-platform, extensible via the C# Dev Kit extension), JetBrains Rider (cross-platform, powerful refactoring), and even Vim/Neovim with an LSP-based C# extension are all viable. For most learners and cross-platform teams, VS Code with the C# Dev Kit offers the best balance of speed and features; the IntelliSense, debugging, and test-explorer integrations all work through the same underlying Roslyn and dotnet tooling regardless of editor.
Cricket analogy: Whether a batsman trains at a full-service academy, a flexible community club with add-on coaches, a specialized elite program, or with a personal coach using minimal gear, they're all ultimately drilled on the same official technique standards.
// Typical first commands after installing the SDK, run from a terminal:
//
// dotnet --version -> prints installed SDK version, e.g. 8.0.100
// dotnet new console -o HelloApp -> scaffolds a new console app in ./HelloApp
// cd HelloApp
// dotnet run -> restores, builds, and runs the app
//
// The generated Program.cs for a console app looks like this:
Console.WriteLine("Hello, .NET!");
// dotnet also manages packages and solutions:
// dotnet add package Newtonsoft.Json
// dotnet new sln -o MySolution
// dotnet sln add HelloApp/HelloApp.csprojThe dotnet CLI plays a role similar to npm/node in JavaScript or cargo in Rust: one binary handles project scaffolding (dotnet new), dependency management (dotnet add package), building (dotnet build), testing (dotnet test), and publishing (dotnet publish) for self-contained or framework-dependent deployment.
Installing multiple SDKs without pinning a version via global.json can lead to a project silently building against a newer SDK than expected, sometimes surfacing subtly different default project settings (e.g., implicit usings or nullable reference types) between machines or CI runners.
- The .NET SDK bundles the Roslyn C# compiler, the runtime, and the dotnet CLI into a single cross-platform install.
dotnet --versionconfirms installation;global.jsonpins a specific SDK version for reproducible builds.dotnet new console -o <name>scaffolds a new project;dotnet runrestores, builds, and executes it in one step.- Editors like VS Code (with C# Dev Kit), Visual Studio, and JetBrains Rider all sit on top of the same dotnet/Roslyn tooling.
dotnet add packageanddotnet restoremanage NuGet dependencies without a separate package manager tool.- LTS (Long-Term Support) SDK versions, such as .NET 8, are recommended for production projects needing multi-year support.
Practice what you learned
1. What single command-line tool is used to create, build, run, and publish .NET projects?
2. What is the purpose of a `global.json` file?
3. Which command scaffolds a brand-new console application?
4. What does 'LTS' mean in the context of .NET SDK release versions?
5. Which of the following is NOT bundled with the .NET SDK install?
Was this page helpful?
You May Also Like
What Is C#?
An overview of C# as a modern, type-safe, object-oriented language built for the .NET platform, covering its history, design goals, and where it fits today.
Hello World and Project Structure
Breaks down the anatomy of a minimal C# console project — Program.cs, the .csproj file, and how top-level statements simplify the classic Hello World example.
NuGet Packages
Understand NuGet, the .NET package manager, and how to add, version, and manage dependencies via PackageReference in modern .NET projects.
Namespaces and Assemblies
Learn how C# namespaces organize code logically while assemblies (.dll/.exe) are the physical, deployable units the .NET runtime actually loads.
Related Reading
Related Study Notes in Programming
Browse all study notesApache Spark Study Notes
Programming · 30 topics
ProgrammingApache Flink Study Notes
Programming · 30 topics
ProgrammingHadoop Study Notes
Programming · 30 topics
ProgrammingSnowflake Study Notes
Programming · 30 topics
ProgrammingApache Airflow Study Notes
Programming · 30 topics
Programmingdbt (Data Build Tool) Study Notes
Programming · 30 topics