How to fix - You must install or update .NET to run this application

Bashar Muhanna 45 Reputation points
2023-06-13T08:40:17.94+00:00
root@ubuntu:/etc/systemd/system# /usr/bin/dotnet /var/www/MinAPI/WebApi.dll
You must install or update .NET to run this application.

App: /var/www/MinAPI/WebApi.dll
Architecture: x64
Framework: 'Microsoft.AspNetCore.App', version '5.0.0' (x64)
.NET location: /usr/lib/dotnet/

The following frameworks were found:
  7.0.5 at [/usr/lib/dotnet/shared/Microsoft.AspNetCore.App]

Learn about framework resolution:
https://aka.ms/dotnet/app-launch-failed

To install missing framework, download:
https://aka.ms/dotnet-core-applaunch?framework=Microsoft.AspNetCore.App&framework_version=5.0.0&arch=x64&rid=ubuntu.23.04-x64
Developer technologies | ASP.NET | ASP.NET Core
Developer technologies | .NET | Other
{count} votes

3 answers

Sort by: Most helpful
  1. Bruce (SqlWork.com) 81,971 Reputation points Volunteer Moderator
    2023-06-13T15:43:50.11+00:00

    you need to install the obsolete .net 5.0 runtime:

    https://dotnet.microsoft.com/en-us/download/dotnet/5.0

    or get a .net 7 build of the app.

    1 person found this answer helpful.

  2. Byron Jones 0 Reputation points
    2023-11-01T19:49:17.87+00:00

    If you are seeing this error in your Azure DevOps CI pipeline, you need to add the following task to your Yaml file, just before the build step:

    - task: UseDotNet@2
      displayName: 'Use .NET 5 sdk'
      inputs:
        packageType: sdk
        version: '5.0.x'
    

  3. can kucukgultekin 255 Reputation points
    2025-11-17T18:01:53.56+00:00

    What the error is telling you is basically. Your app was built for Microsoft.AspNetCore.App 5.0.0, but on this machine only 7.0.5 is installed. The .NET host will not jump from 5.0 to 7.0 automatically, so it just fails with the generic “You must install or update .NET to run this application” message.

    So right now:

    – The app targets net5.0 / AspNetCore 5.0.0.

    – The server only has AspNetCore 7.0.5 installed.

    – .NET 5 is already end-of-life and isn’t officially provided for newer Ubuntu releases anymore.

    The best fix is not to fight the runtime, but to upgrade the app...

    On your dev machine, open the project and change the TargetFramework in the csproj to net7.0 (or net8.0 if you can).

    Update your ASP.NET Core and other NuGet packages to supported versions.

    1. Rebuild and publish the app again.

    Deploy the new DLLs to the server and run the same command: /usr/bin/dotnet /var/www/MinAPI/WebApi.dll

    Since the server already has Microsoft.AspNetCore.App 7.0.5, once your app targets net7.0 the host will find a matching framework and the error will simply disappear.

    If, for some reason, you really can’t touch the code and must run this exact net5.0 dll on a modern Ubuntu, that’s where life gets ugly: .NET 5 is out of support and not officially available for newer Ubuntu releases, plus there are OpenSSL compatibility issues. At that point you’d need either an older, supported OS like Ubuntu 20.04 or a custom manual installation of the old runtime, which is not something you want in production.

    You don’t think of this as .NET is broken :).. think of it as "the app’s required framework version doesn’t match what’s installed on the box". The durable solution is to move the app to a supported .NET version rather than chasing an obsolete runtime on a new distro.

    0 comments No comments

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.