The .NET SDK is the set of tools that build and run C# code on a machine.
This page covers the .NET SDK, the toolset for C#. For a language-agnostic introduction to programs that turn source code into a program that runs, see Compiler.
Why the .NET SDK Exists#
C# code cannot run on its own. Before it can do anything, it has to be turned into a form the machine can execute, and then something has to execute it. The .NET SDK provides both parts, along with the command used to drive them.
SDK stands for Software Development Kit. Installing the .NET SDK puts everything needed to go from a C# file to a running program in one place, so there is nothing else to piece together to start.
The word .NET on its own names the wider platform, the whole ecosystem of tools, libraries, and languages that C# is part of. It is not something installed by that name. The .NET SDK is the specific, installable part of that platform used to build and run code, and it is what gets downloaded to start writing C#.
What Is Inside#
The .NET SDK bundles three things that work together:
- The compiler, which turns C# source code into a form the machine can run.
- The runtime, the part that executes that form and keeps the program running.
- The
dotnetcommand, a single terminal command that creates projects, builds them, and runs them.
Because all three come together, one install is enough to write and run C# without adding anything further.
The dotnet Command#
The dotnet command is the entry point to the SDK from the terminal. It builds and runs a project with a single instruction:
dotnet runThe command compiles the code and then runs the result, printing any output to the terminal.
Thinking the .NET SDK is a different language
The .NET SDK is not a language. The language is C#. The SDK is the toolset that builds and runs C# code. The same C# runs whatever installs it, as long as a compatible SDK is present.
Confusing the .NET SDK with the .NET Runtime
The runtime on its own only runs a program that was already built. It cannot build one. The .NET SDK includes the runtime and adds the compiler and the dotnet command on top, so it is the SDK, not the runtime alone, that is needed to write and build code.
Assuming Visual Studio is required for C#
Visual Studio is one way to work with C#, but it is not required. The .NET SDK is a separate install that works from the terminal and with any editor, including Visual Studio Code. Installing the SDK is enough to build and run C# without Visual Studio.
📚 Resources
- What is .NET (external link), official overview
- .NET SDK overview (external link), official docs
- dotnet command reference (external link), official docs