当我使用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的托管包,但仍然有这个问题
您是否知道问题是什么以及如何解决?
3条答案
按热度按时间uurity8g1#
全局卸载已弃用的软件包:-
然后尝试重新安装最新的软件包版本:-
如果不起作用,请尝试第二个过程:-
所以您已经安装了.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核心应用程序将开始工作。
x4shl7ld2#
我也有同样的问题。
我手动将以下行添加到
.csproj
文件中: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