gpt4 book ai didi

linux - 找不到框架 'Microsoft.AspNetCore.App'和版本 '5.0.0'。当它安装在$ PATH中时

转载 作者:行者123 更新时间:2023-12-03 16:01:02 24 4
gpt4 key购买 nike

我正在Manjaro Linux中工作。
我有一个.NET Core项目。当我运行dotnet build .时,该解决方案构建良好
但是,当我运行时:

dotnet-ef update --project Bejebeje.DataAccess --startup-project Bejebeje.Mvc
我收到以下奇怪的错误:
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
这很奇怪,因为我已经安装了.NET 5.0的SDK和运行时。
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 ⇒
为什么会这样呢?我该怎么做才能解决问题?

最佳答案

我有同样的问题。您需要有一个 ASP.NET 运行时。
这有点令人困惑,容易被忽略,但是它说您需要一个Microsoft. AspNetCore .App运行时,并且dotnet --list-runtimes仅列出Microsoft. NETCore .App s。
ArchWiki提到:

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.


要安装.NET 5运行时,请执行以下操作:
sudo pacman -Sy aspnet-runtime
或者如果您需要3.1版本:
sudo pacman -Sy aspnet-runtime-3.1
现在有一个ASP运行时可用:
$ 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]

关于linux - 找不到框架 'Microsoft.AspNetCore.App'和版本 '5.0.0'。当它安装在$ PATH中时,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/66301462/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com