Search code examples
linuxasp.net-coremanjaro

The framework 'Microsoft.AspNetCore.App', version '5.0.0' was not found. when it is installed and inside $PATH


I am working in Manjaro Linux.

I have a .NET Core project. The solution builds fine when I run dotnet build .

However, when I run:

dotnet-ef update --project Bejebeje.DataAccess --startup-project Bejebeje.Mvc

I get the following strange error:

Build started...
Build succeeded.
It was not possible to find any compatible framework version
The framework 'Microsoft.AspNetCore.App', version '5.0.0' was not found.
  - No frameworks were found.

You can resolve the problem by installing the specified framework and/or SDK.

The specified framework can be found at:
 - https://aka.ms/dotnet-core-applaunch?framework=Microsoft.AspNetCore.App&framework_version=5.0.0&arch=x64&rid=manjaro-x64

It is strange because I already have the SDKs and runtimes for .NET 5.0 installed.

bejebeje|feature/upgrade-to-net-5 ⇒ dotnet --list-sdks
3.1.108 [/usr/share/dotnet/sdk]
5.0.103 [/usr/share/dotnet/sdk]
bejebeje|feature/upgrade-to-net-5 ⇒ dotnet --list-runtimes
Microsoft.NETCore.App 3.1.8 [/usr/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 5.0.3 [/usr/share/dotnet/shared/Microsoft.NETCore.App]
bejebeje|feature/upgrade-to-net-5 ⇒

Why is this happening? and what can I do to solve the problem?


Solution

  • I had the same problem. You need to have an ASP.NET runtime.

    It's a bit confusing and easily overlooked, but it says you need an Microsoft.AspNetCore.App runtime, and your dotnet --list-runtimes only lists Microsoft.NETCore.Apps.

    The ArchWiki mentions:

    This is caused because the runtime is shipped as a separate package in Arch. You just need to make sure you have the aspnet-runtime package installed as well.

    To install the .NET 5 runtime:

    sudo pacman -Sy aspnet-runtime
    

    or if you need the 3.1 version:

    sudo pacman -Sy aspnet-runtime-3.1
    

    Now there's an ASP runtime available:

    $ dotnet --list-runtimes
    Microsoft.AspNetCore.App 5.0.4 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]  # <<<
    Microsoft.NETCore.App 5.0.4 [/usr/share/dotnet/shared/Microsoft.NETCore.App]