Does an ASP.NET Core 10 app pick up .NET security patches by itself, and how does that differ for framework-dependent and self-contained deployments?
answer
- patches roll forward, majors do not
- highest installed 10.0.x runtime wins
- self-contained: republish to patch
- RollForward, DOTNET_ROLL_FORWARD, --roll-forward
- NuGet packages are not patched by the runtime
basics
~20 sA framework-dependent ASP.NET Core 10 app runs on the highest installed 10.0.x runtime, so installing a patch and restarting picks it up. A self-contained app carries its own runtime and must be republished, and NuGet packages are bumped separately in either case.
solid answer
~50 sFor a framework-dependent app the `dotnet` host chooses, at every start, the highest installed patch of the major.minor the app targets, for both `Microsoft.NETCore.App` and `Microsoft.AspNetCore.App`; install 10.0.12 on the server, restart the app, and it runs on 10.0.12 without a rebuild. That roll-forward stops at the major version: by default a `net8.0` app will not start on a machine that has only .NET 10, unless you change the `RollForward` setting. A self-contained app bundles the runtime it was published with, chosen as the latest patch the publishing SDK knows, so it only gets a patch when you republish with a newer SDK and redeploy; a container image is the same in practice and must be rebuilt on a patched base image. Neither path touches NuGet packages such as `Microsoft.AspNetCore.Authentication.JwtBearer`: their versions are fixed in the project file until you bump them.
code
bash · 10 lines# Framework-dependent: install the patch, restart, done
dotnet --list-runtimes
# Microsoft.AspNetCore.App 10.0.9 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
# Microsoft.AspNetCore.App 10.0.12 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
# Self-contained: the runtime is chosen at publish time, so republish
dotnet publish -c Release -r linux-x64 --self-contained
# Is anything on this machine out of date or out of support?
dotnet sdk checkgo deeper
Recall that patches roll forward automatically for framework-dependent apps and that self-contained apps must be republished.
Explain how the host picks the highest installed patch at start-up, why majors do not roll forward, and which settings change that.
Design the monthly patch routine for each deployment style: runtime installs and restarts, republished self-contained builds, rebuilt images and bumped packages.
Decide deployment styles across the estate partly on how cheaply each one can take a security patch every month.
## What counts as a patch .NET versions read **major.minor.patch**. A servicing update moves the patch number, 10.0.11 to 10.0.12, ships almost every month (security fixes on Patch Tuesday, the second Tuesday), keeps compatibility and is the only supported servicing level until the next one ships. So the operational question is not whether to take patches but how they reach each kind of deployment. ## Framework-dependent apps A framework-dependent app is the default output of `dotnet publish`: your assemblies plus a `*.runtimeconfig.json` naming the frameworks it needs. For an ASP.NET Core app those are `Microsoft.NETCore.App` and `Microsoft.AspNetCore.App`. Whether you start it as `dotnet MyApp.dll` or through the app host executable, the `dotnet` host resolves the frameworks at **every start**: 1. It looks for installed versions of the targeted major.minor, such as 10.0.*. 2. It picks the **highest patch** installed, such as 10.0.12 over 10.0.9. 3. Only if no 10.0.* exists does it try a higher minor of the same major; it never moves to a higher major by default. Installing a runtime patch on the server therefore patches every framework-dependent app on it, once each app process restarts. Nothing is rebuilt. ## Self-contained apps A self-contained app (`dotnet publish -r linux-x64 --self-contained`) copies the runtime and ASP.NET Core into the publish folder. Version selection happens **at publish time**: restore picks the latest patch the publishing SDK knows, and that runtime is frozen into the output. Installing a newer runtime on the server changes nothing for it. To patch it you update the SDK on the build machine, republish and redeploy. The `TargetLatestRuntimePatch` property controls this selection, and it defaults to on for self-contained builds. **Containers** behave like self-contained apps in practice: an image holds whatever runtime its base image had when it was built, whether the app inside is framework-dependent or self-contained. Patching therefore means rebuilding the image on an updated base image tag and redeploying, which is why image rebuilds belong in the monthly patch routine. ## Majors do not roll forward The roll-forward policy is set by the `RollForward` MSBuild property (written to `runtimeconfig.json` as `rollForward`), by the `DOTNET_ROLL_FORWARD` environment variable, or by `--roll-forward` on the `dotnet` command, the later ones overriding the earlier. | Value | Behaviour | |---|---| | `Minor` | the default: latest patch of the requested major.minor, else the lowest higher minor | | `LatestPatch` | latest patch of the requested major.minor only | | `Major` | like Minor, then the lowest higher major | | `LatestMinor` | highest minor of the requested major | | `LatestMajor` | highest installed version of any major | | `Disable` | exact version only | Setting `Major` or `LatestMajor` lets a `net8.0` app run on .NET 10, but it then runs on a framework it was never built or tested against; it is an emergency measure, not an upgrade. ## What a runtime patch does not touch - **NuGet packages.** `Microsoft.AspNetCore.Authentication.JwtBearer`, `Microsoft.AspNetCore.OpenApi`, EF Core and its providers load from the app's own folder at the version in the project file. When a fix ships in a package, you bump the `PackageReference` and redeploy. - **The SDK on build agents.** It needs its own updates, and for self-contained apps it decides which runtime patch gets bundled. ## A monthly patch checklist 1. Install the new runtime on servers that host framework-dependent apps, then restart or recycle each app. 2. Rebuild container images on the updated base image tag and redeploy them. 3. Update the SDK on build agents, then republish and redeploy self-contained apps. 4. Bump Microsoft packages that had a fix in the same release, such as an authentication or EF Core package, and redeploy. ## Checking what you have - `dotnet --list-runtimes` lists every installed `Microsoft.NETCore.App` and `Microsoft.AspNetCore.App` version on a machine. - `dotnet sdk check` reports, per feature band, whether installed SDKs and runtimes are current or out of support.
- Why does a framework-dependent app need a restart after a runtime patch is installed?The host resolves framework versions when the process starts and loads that runtime into the process. A running process keeps the runtime it started with; only a new process, after a service restart or an app pool recycle, picks the highest installed patch.
- Would you set RollForward to LatestMajor so apps survive the removal of an old runtime?Not as a policy. LatestMajor runs the app on a major version it was never built or tested against, where breaking changes apply silently. It can keep a forgotten app alive briefly, but the real fix is retargeting, rebuilding and testing on the new major.
- A self-contained app picks up runtime patches installed on the server.
- Installing a runtime patch requires rebuilding every framework-dependent app.
- A net8.0 app automatically runs on .NET 10 once .NET 8 is removed.
- Runtime patches also update NuGet packages such as Microsoft.AspNetCore.Authentication.JwtBearer.
- A running app switches to a newly installed patch without a restart.