.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.

Introduction & Quick Summary
A published .NET application refuses to start on a server or in a container:
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.
dotnet --list-runtimes
dotnet --list-sdks
dotnet MyApi.dll # same message when the runtime is missingTwo 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"
}
}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.| Setting | Value | Behaviour |
|---|---|---|
framework.name | Microsoft.NETCore.App | console and library apps |
framework.name | Microsoft.AspNetCore.App | apps using the shared web framework |
rollForward | Minor (default) | accepts a higher patch or minor within the same major |
rollForward | LatestMinor | newest minor in the same major |
rollForward | LatestMajor | any newer major, may break at run time |
rollForward | Disable | exact version only |
| environment | DOTNET_ROLL_FORWARD | overrides the file |
| environment | DOTNET_ROLL_FORWARD_TO_PRERELEASE=1 | allows 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 runtime | App asks for | Result with default policy |
|---|---|---|
| 8.0.11 | 8.0.0 | runs, minor roll-forward |
| 8.0.0 | 8.0.11 | fails, cannot roll back |
| 9.0.0 | 8.0.0 | fails, major not allowed |
| 9.0.0 | 8.0.0 with LatestMajor | runs, untested combination |
| 8.0.0 only | 8.0.0, app published self-contained | ignores installed runtime |
| none | any framework-dependent app | this error |
Key Comparison Table
| Deployment | Size | Needs runtime installed | Upgrade control |
|---|---|---|---|
| framework-dependent | small, a few MB | yes, matching major | central, patch on host |
| self-contained | large, 60-100 MB | no | per app, redeploy to patch |
| single file self-contained | one binary, large | no | per app |
| ReadyToRun self-contained | large plus native code | no | per app, faster start |
| Native AOT | medium, no JIT | no | per app, trimmed APIs |
| Environment | Wrong setup | Correct setup |
|---|---|---|
| Docker | mcr.microsoft.com/dotnet/sdk:8.0 as the final image | aspnet:8.0 or runtime:8.0 |
| Docker, ASP.NET | runtime:8.0 for a web app | aspnet:8.0, includes ASP.NET Core |
| Linux server | only the SDK installed by a script | install the runtime package for the target major |
| Windows Server | hosting bundle for another major | hosting bundle matching the app |
| ARM server | x64 publish | -r linux-arm64 or --arch arm64 |
| Alpine | glibc 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
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
# 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.0The 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
dotnet publish -c Release -r linux-x64 --self-contained true -o out
./out/MyApiSelf-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
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 /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
file out/MyApi
# ELF 64-bit LSB executable, x86-64Running 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-sdksshows 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.
LatestMajorin 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_ROOTpointing at the wrong install. A container with two runtime locations, or a service unit with a staleDOTNET_ROOT, reports a missing framework that is actually present.- ASP.NET Core versus base runtime. A web app needs
Microsoft.AspNetCore.App; installing onlyMicrosoft.NETCore.Appleaves 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-depsimage is a different failure; setInvariantGlobalization=trueor 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 documentationThe C# documentation that defines the behaviour this guide explains.
Try matching browser tools
All toolsSmall utilities that fit C# work — they run entirely in this browser tab, so nothing you paste leaves your device.
Related C# guides
All C# guidesC# CS0117: 'X' does not contain a definition for 'Y'
CS0117 means the compiled assembly has no such member, usually from an older target framework or package. Check the API surface before editing code.
C# CS0246: The type or namespace name could not be found
CS0246 is a compile-time resolution failure: a missing using, package, target framework, or an unrestored project. Trace it backward from the symbol.
CS1061: does not contain a definition for and no extension method
Member lookup failed on both instance and extension methods. Type inference, missing using directives, target frameworks and packages explain most cases.
C#: NullReferenceException: Object reference not set
The message never names the null. Read the stack trace, enable nullable reference types, and use null-conditional access instead of guessing.
More in C#
All C# guidesThe guides filed next to this one in C#, in library order.