简体   繁体   中英

The framework 'Microsoft.NETCore.App', version '5' was not found while Microsoft.NETCore.App 5.0.0 is found

when I use the do.net command I have an issue

> dotnet Mydll.dll
It was not possible to find any compatible framework version
The framework 'Microsoft.NETCore.App', version '5' was not found.
  - The following frameworks were found:
      2.1.23 at [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
      2.2.7 at [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
      2.2.8 at [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
      3.0.3 at [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
      3.1.4 at [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
      3.1.9 at [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
      3.1.10 at [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
      5.0.0 at [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
      5.0.7 at [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]

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.NETCore.App&framework_version=5&arch=x64&rid=win10-x64

I am a little suprised cause it seems I have the the runtime Microsoft.NETCore.App 5.0.0 installed and also the 5.0.7

>dotnet --list-runtimes

Microsoft.AspNetCore.All 2.1.23 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.All 2.2.7 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.All 2.2.8 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.App 2.1.23 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 2.2.7 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 2.2.8 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 3.0.3 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 3.1.4 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 3.1.9 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 3.1.10 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 5.0.0 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 5.0.7 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.NETCore.App 2.1.23 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 2.2.7 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 2.2.8 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 3.0.3 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 3.1.4 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 3.1.9 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 3.1.10 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 5.0.0 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 5.0.7 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.WindowsDesktop.App 3.0.3 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 3.1.4 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 3.1.9 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 3.1.10 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 5.0.0 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]

I have installed the Hosting Bundle of ASP.NET Core Runtime 5.0.7 for being sure but still have the issue

Would you have an idea nout what is the issue and how to fix it?

Uninstall deprecated package globally:-

dotnet tool uninstall dotnet-ef -g

And then try to Reinstall the up-to-date package version:-

dotnet tool install --global dotnet-ef --version 5.0.1 

If not work, try to second process:-

So you have already installed .Net 5.

download dotnet-sdk-5.0.301-win-x64.zip and copied Microsoft.AspNetCore.App\\5.0.301 folder manually from the zip file to C:\\ProgramFiles\\dotnet\\shared\\Microsoft.AspNetCore.App\\5.0.301

then hope the asp.net core application will be started working.

I had the same problem.

I added the following line to .csproj file manually:

<ItemGroup>
    <FrameworkReference Include="Microsoft.AspNetCore.App" />
</ItemGroup>

I had this kind of issue when trying to start my application from Visual Studio.

Update you Visual Studio using Visual Studio Installer solved this for me.

Direct download installer places the files in this folder

C:\Program Files\do.net\shared\Microsoft.AspNetCore.App

And Visual Studio installer places the files in this folder

C:\Program Files\do.net\shared\Microsoft.NETCore.App

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM