.NET Runtime vs SDK
The .NET Runtime is the minimum set of components needed to execute an already-built .NET application — it includes the CoreCLR execution engine, the JIT compiler, the garbage collector, and the base class libraries. The .NET SDK is a much larger superset that includes the runtime plus the dotnet CLI, MSBuild, the C#/F#/VB compilers (Roslyn), and NuGet client tooling, meaning the SDK is what you install to develop and build software, while the runtime alone is what you install just to run already-compiled applications.
Cricket analogy: Like the difference between owning a full training academy with coaches, nets, and equipment (SDK) versus just owning a stadium that can host a match already scheduled (Runtime), the SDK lets you develop while the runtime just lets you execute.
Types of Runtimes
There are three distinct installable runtimes: Microsoft.NETCore.App (the core runtime for console and generic apps), Microsoft.AspNetCore.App (adds ASP.NET Core's web hosting libraries on top of the core runtime), and Microsoft.WindowsDesktop.App (adds WPF and WinForms for Windows desktop apps). Installing the ASP.NET Core runtime automatically includes the core runtime beneath it, but installing only the core runtime will not let you host an ASP.NET Core web app, since the required Kestrel and middleware assemblies are absent.
Cricket analogy: Like a base fitness certification (core runtime) versus an additional fast-bowling specialization certificate (ASP.NET Core runtime) that assumes and builds on the base fitness cert, each additional .NET runtime builds on top of the core runtime.
Choosing What to Install
On a developer workstation you install the full SDK, since it contains everything needed to write, build, and debug code including the runtime itself. On a production server or inside a Docker container that only runs a pre-built application, you install just the appropriate runtime (e.g., the mcr.microsoft.com/dotnet/aspnet:8.0 image rather than the much larger mcr.microsoft.com/dotnet/sdk:8.0 image), which reduces image size, attack surface, and startup overhead since compiler and build tooling are unnecessary at runtime.
Cricket analogy: Like a player carrying their full training kit (bat, pads, extra gloves, coaching notes) to nets versus carrying only match-day gear onto the field, developers use the full SDK while production servers use only the lean runtime.
# Multi-stage Dockerfile: build with the SDK, run with just the runtime
FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build
WORKDIR /src
COPY . .
RUN dotnet publish OrdersApi/OrdersApi.csproj -c Release -o /app/publish
FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS final
WORKDIR /app
COPY --from=build /app/publish .
ENTRYPOINT ["dotnet", "OrdersApi.dll"]
Run dotnet --info to see a full breakdown of installed SDKs, runtimes, and the current default runtime environment — useful when diagnosing 'wrong version' errors in CI.
- The .NET Runtime executes already-built apps; the .NET SDK includes the runtime plus compilers, MSBuild, and the CLI.
- Microsoft.NETCore.App is the base runtime; ASP.NET Core and WindowsDesktop runtimes build on top of it.
- Developer machines need the full SDK; production servers and containers need only the appropriate runtime.
- Multi-stage Dockerfiles typically use the sdk image to build and the smaller aspnet or runtime image to run.
- Installing only the core runtime is not enough to host an ASP.NET Core app — the ASP.NET Core runtime is required.
dotnet --infoshows installed SDKs and runtimes for troubleshooting version mismatches.- Using the leaner runtime image in production reduces container size, attack surface, and cold-start time.
Practice what you learned
1. What is the minimum component set needed to run an already-compiled .NET application?
2. Which of the following is included in the SDK but NOT in the runtime alone?
3. Which runtime must be installed to host an ASP.NET Core web application?
4. In a production Docker container that only runs a pre-built app, which base image is typically preferred?
5. Which command shows a full breakdown of installed SDKs and runtimes?
Was this page helpful?
You May Also Like
What Is .NET Core?
An overview of .NET Core as Microsoft's open-source, cross-platform runtime and how it evolved into the unified modern .NET.
Target Frameworks and TFMs
Understanding Target Framework Monikers (TFMs) like net8.0 and netstandard2.0, and how to multi-target a .NET project.
.NET CLI Basics
How to use the dotnet command-line interface to scaffold, build, test, and publish .NET applications.
Related Reading
Related Study Notes in Microsoft Technologies
Browse all study notesWindows 10 / UWP Development Study Notes
.NET · 30 topics
Microsoft TechnologiesWindows Batch Scripting Study Notes
Batch · 30 topics
Microsoft TechnologiesMFC (Microsoft Foundation Classes) Study Notes
C++ · 30 topics
Microsoft TechnologiesSilverlight Study Notes
.NET · 30 topics
Microsoft TechnologiesXAML Study Notes
.NET · 30 topics
Microsoft TechnologiesWPF (Windows Presentation Foundation) Study Notes
.NET · 30 topics