未找到框架“Microsoft.NETCore. App”版本“5”,但找到了Microsoft.NETCore.App 5.0.0

sq1bmfud  于 2022-12-05  发布在  .NET
关注(0)|答案(3)|浏览(794)

当我使用dotnet命令时,我遇到了一个问题

> 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

我有点惊讶,因为我似乎安装了运行时微软。NETCore。应用程序5. 0. 0和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]

我已经安装了ASP.NET核心运行时5.0.7的托管包,但仍然有这个问题
您是否知道问题是什么以及如何解决?

uurity8g

uurity8g1#

全局卸载已弃用的软件包:-

dotnet tool uninstall dotnet-ef -g

然后尝试重新安装最新的软件包版本:-

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

如果不起作用,请尝试第二个过程:-

所以您已经安装了.Net 5。
下载dotnet-sdk-5.0.301-win-x64.zip并手动将Microsoft.AspNetCore.App\5.0.301文件夹从zip文件复制到C:\ProgramFiles\dotnet\shared\Microsoft.AspNetCore.App\5.0.301
然后希望asp.net核心应用程序将开始工作。

x4shl7ld

x4shl7ld2#

我也有同样的问题。
我手动将以下行添加到.csproj文件中:

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

t40tm48m3#

我在尝试从Visual Studio启动应用程序时遇到了这种问题。

更新您的Visual Studio使用Visual Studio安装程序解决了这个问题。

直接下载安装程序将文件放置在此文件夹中
C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App
Visual Studio安装程序将文件放在此文件夹中
C:\Program Files\dotnet\shared\Microsoft.NETCore.App

相关问题