What is the .NET SDK, and how does it differ from the .NET Runtime?
Short answer
The .NET SDK includes everything needed to build, run, and publish .NET applications: the compiler (Roslyn for C#), the dotnet CLI, MSBuild, and the runtime.
Advertisement
AModel answer
The .NET SDK includes everything needed to build, run, and publish .NET applications: the compiler (Roslyn for C#), the dotnet CLI, MSBuild, and the runtime. The .NET Runtime alone only includes what's needed to execute already-built applications (CLR, base libraries) without build tools. Developer machines need the SDK; production servers running pre-built apps only need the runtime.
# Check installed SDKs and runtimes
dotnet --list-sdks
dotnet --list-runtimes
dotnet --versionReal-world example
A CI build agent installs only the SDK to compile and publish an app, while the production Docker image uses a lightweight aspnet:runtime base image without the full SDK to reduce image size.
Likely follow-ups
- What are the different runtime types (ASP.NET Core, Desktop, base .NET)?
- How do multiple SDK versions coexist on one machine?
Related topics