dotnet "The framework Microsoft.AspNetCore.App was not found"
An ASP.NET Core app (or test) tried to run but the Microsoft.AspNetCore.App shared framework is not installed. The base .NETCore.App runtime is present, but the ASP.NET Core runtime bundle the app needs is not.
What this error means
Running the app or dotnet test for a web project fails with "The framework 'Microsoft.AspNetCore.App', version x was not found", listing the frameworks that are present. Building succeeded; the ASP.NET Core runtime is just absent.
You must install or update .NET to run this application.
Framework: 'Microsoft.AspNetCore.App', version '8.0.0' (x64)
The following frameworks were found:
8.0.6 at [/usr/share/dotnet/shared/Microsoft.NETCore.App]Common causes
Only the base runtime is installed
The runner has Microsoft.NETCore.App but not Microsoft.AspNetCore.App. A dotnet/runtime image or a runtime-only install lacks the ASP.NET Core shared framework.
Runtime image is not the aspnet image
A multi-stage Docker build whose final stage uses dotnet/runtime (not dotnet/aspnet) has no ASP.NET Core framework for a web app to run on.
How to fix it
Install the ASP.NET Core runtime
Install the SDK (which includes the ASP.NET Core framework) or the ASP.NET Core runtime explicitly.
- uses: actions/setup-dotnet@v4
with:
dotnet-version: '8.0.x' # includes Microsoft.AspNetCore.AppUse the aspnet runtime image in Docker
Base the final stage on dotnet/aspnet so the ASP.NET Core shared framework is present.
FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS runtime
WORKDIR /app
COPY --from=build /app/publish .
ENTRYPOINT ["dotnet", "MyWebApp.dll"]How to prevent it
- Use the
dotnet/aspnetimage (notdotnet/runtime) for ASP.NET Core apps. - Install the ASP.NET Core runtime, not just the base runtime, where web apps run.
- Match the shared-framework version to your project’s
TargetFramework.