Pages

Topics

Tools

↑↓navigate↵openescclose
All guides

.NET: The framework 'Microsoft.NETCore.App' was not found

A framework-dependent app asks for a runtime major that is absent. Install the matching runtime or publish self-contained, and match Docker tags.

~5 min readC#
#dotnet#runtime#containers#deployment
Bold white headline reading RUNTIME MISSING beside a cyan .NET crate with an amber empty framework slot.

Introduction & Quick Summary

A published .NET application refuses to start on a server or in a container:

code
You must install or update .NET to run this application. App: /app/MyApi.dll Architecture: x64 Framework: 'Microsoft.NETCore.App', version '8.0.0' (x64) .NET location: /usr/share/dotnet The following frameworks were found: 9.0.0 at [/usr/share/dotnet/shared/Microsoft.NETCore.App]

Quick answer: the app was built as framework-dependent and asks for a runtime major version that is not installed on that machine. The SDK that compiled it is irrelevant at run time; only the shared runtime matters.

bash
dotnet --list-runtimes dotnet --list-sdks dotnet MyApi.dll # same message when the runtime is missing

Two fixes are legitimate: install the requested runtime, or publish self-contained so the app carries its own runtime. Everything else — roll-forward, base image tags, architecture — is a variation on those two. This guide explains why the version is pinned, how roll-forward policy changes the search, and how containers and CI pick the wrong image so often.

Core Mechanics, Signatures & Reproducible Setup

A framework-dependent app ships an apphost, the managed DLLs, MyApi.runtimeconfig.json and MyApi.deps.json. The host reads framework from runtimeconfig.json, then searches the shared runtime folders for a compatible version.

{ "runtimeOptions": { "tfm": "net8.0", "framework": { "name": "Microsoft.NETCore.App", "version": "8.0.0" }, "rollForward": "Minor" } }
bash
dotnet new web -n MyApi -f net8.0 cd MyApi && dotnet publish -c Release -o out DOTNET_ROOT=/tmp/empty ./out/MyApi # You must install or update .NET to run this application.
SettingValueBehaviour
framework.nameMicrosoft.NETCore.Appconsole and library apps
framework.nameMicrosoft.AspNetCore.Appapps using the shared web framework
rollForwardMinor (default)accepts a higher patch or minor within the same major
rollForwardLatestMinornewest minor in the same major
rollForwardLatestMajorany newer major, may break at run time
rollForwardDisableexact version only
environmentDOTNET_ROLL_FORWARDoverrides the file
environmentDOTNET_ROLL_FORWARD_TO_PRERELEASE=1allows preview runtimes

The default policy explains the most common server mismatch: an app built for 8.0 runs on 8.0.x but not on 9.0.x, because rolling forward across a major version is not automatic.

Installed runtimeApp asks forResult with default policy
8.0.118.0.0runs, minor roll-forward
8.0.08.0.11fails, cannot roll back
9.0.08.0.0fails, major not allowed
9.0.08.0.0 with LatestMajorruns, untested combination
8.0.0 only8.0.0, app published self-containedignores installed runtime
noneany framework-dependent appthis error

Key Comparison Table

DeploymentSizeNeeds runtime installedUpgrade control
framework-dependentsmall, a few MByes, matching majorcentral, patch on host
self-containedlarge, 60-100 MBnoper app, redeploy to patch
single file self-containedone binary, largenoper app
ReadyToRun self-containedlarge plus native codenoper app, faster start
Native AOTmedium, no JITnoper app, trimmed APIs
EnvironmentWrong setupCorrect setup
Dockermcr.microsoft.com/dotnet/sdk:8.0 as the final imageaspnet:8.0 or runtime:8.0
Docker, ASP.NETruntime:8.0 for a web appaspnet:8.0, includes ASP.NET Core
Linux serveronly the SDK installed by a scriptinstall the runtime package for the target major
Windows Serverhosting bundle for another majorhosting bundle matching the app
ARM serverx64 publish-r linux-arm64 or --arch arm64
Alpineglibc build on musl image-r linux-musl-x64 and an Alpine base image

Practical Edge Cases, Error Fixes & Deep Dive Code Examples

1. Read the message properly

text
Framework: 'Microsoft.NETCore.App', version '8.0.0' (x64) The following frameworks were found: 9.0.0 at [...]

The first line is what the app needs, the second is what exists. When the list is empty, no runtime is installed at all. When the app is ASP.NET Core and the list shows only Microsoft.NETCore.App, the web framework is missing; install the ASP.NET Core runtime rather than the base runtime.

2. Install the runtime, not the SDK

bash
# Ubuntu sudo apt-get install -y dotnet-runtime-8.0 sudo apt-get install -y aspnetcore-runtime-8.0 # verify dotnet --list-runtimes | grep 8.0

The SDK includes a runtime, which is why the app works on a developer laptop and fails on a clean server. Production hosts need the runtime package or the hosting bundle, and the version must match the target framework in the project file.

3. Publishing self-contained

bash
dotnet publish -c Release -r linux-x64 --self-contained true -o out ./out/MyApi

Self-contained removes the dependency on the host runtime and pins the app to the exact version it was built with. The cost is size and the need to redeploy for runtime security patches. Trimmed and AOT builds go further and require checking reflection-heavy libraries.

4. Docker base image tags

dockerfile
FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build WORKDIR /src COPY . . RUN dotnet publish -c Release -o /app FROM mcr.microsoft.com/dotnet/aspnet:8.0 WORKDIR /app COPY --from=build /app . ENTRYPOINT ["dotnet", "MyApi.dll"]

The two tags must match the target framework. A net8.0 project built with sdk:9.0 published framework-dependent still asks for 8.0 at run time, and an aspnet:9.0 final image fails with this error. Pin the patch level in production (aspnet:8.0.11) if you want reproducible patches.

5. global.json and SDK selection

{ "sdk": { "version": "8.0.404", "rollForward": "latestFeature" } }

global.json selects the SDK used to build, not the runtime used to run. A build agent without the pinned SDK fails earlier with "compatible SDK was not found", which is a different error and a different fix. Keep both files in the repository and check dotnet --info on the agent.

6. Architecture and libc

bash
file out/MyApi # ELF 64-bit LSB executable, x86-64

Running an x64 app on arm64 Linux fails with an exec format error, and a glibc-built app on Alpine fails when the loader is missing. The framework message can appear on Alpine because the host cannot find libhostfxr.so in the expected location; publishing for linux-musl-x64 or switching the base image fixes it. Use the environment file parser to inspect DOTNET_ROOT and ASPNETCORE_URLS, and the compose editor to confirm the image tag the container actually runs.

Common Compilation/Runtime Mistakes & Version Gotchas

  • Confusing SDK and runtime. dotnet --list-sdks shows build tools; the app only needs --list-runtimes. Installing the SDK on a server works but drags in build tooling that production does not need.
  • Assuming patch updates are transparent. A host patched from 8.0.0 to 8.0.11 runs the app by minor roll-forward; a host patched to 9.0 does not.
  • LatestMajor in production. It makes an app start on an untested runtime and can turn a missing dependency into a subtle behaviour change. Prefer installing the correct runtime.
  • DOTNET_ROOT pointing at the wrong install. A container with two runtime locations, or a service unit with a stale DOTNET_ROOT, reports a missing framework that is actually present.
  • ASP.NET Core versus base runtime. A web app needs Microsoft.AspNetCore.App; installing only Microsoft.NETCore.App leaves the message intact.
  • Hosting bundle order. On IIS, the ASP.NET Core Module and the hosting bundle must match the app's major version; installing a newer bundle does not make an older app find its runtime automatically.
  • Version notes. .NET 8 and .NET 9 are supported at the same time; support windows differ, and .NET 6 reached end of support in November 2024, so servers built from old images can be missing a runtime nobody maintains.
  • Container globalization. An app that starts fine locally but throws culture errors in a runtime-deps image is a different failure; set InvariantGlobalization=true or install ICU rather than adding the SDK.

The reliable pattern is to decide per deployment: either pin the runtime on the host and patch it centrally, or publish self-contained and redeploy per patch. Matching the Docker tags and the target framework removes the error at build time, before it reaches a server.

Official documentation: how to detect installed .NET versions and .NET runtime version selection.

Official references

primary documentation

The C# documentation that defines the behaviour this guide explains.

Try matching browser tools

All tools

Small utilities that fit C# work — they run entirely in this browser tab, so nothing you paste leaves your device.

All C# guides

More in C#

All C# guides

The guides filed next to this one in C#, in library order.