![](/img/trans.png)
[英]New ASP.NET Core Project does not build; "The framework 'Microsoft.NETCore.App', version '2.0.9' was not found."
[英]The specified framework 'Microsoft.NETCore.App', version '2.2.0' was not found
我正在使用 Visual Studio 2019 版本 16.3.7。 我認為這是最新的更新。
當我嘗試編譯基本的 .NET Core 2.2 控制台應用程序時:
...我收到以下錯誤:
It was not possible to find any compatible framework version
The specified framework 'Microsoft.NETCore.App', version '2.2.0' was not found.
- The following frameworks were found:
1.0.1 at [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
2.0.9 at [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
2.1.11 at [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
2.1.12 at [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
2.1.13 at [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
3.0.0 at [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
You can resolve the problem by installing the specified framework and/or SDK.
The .NET Core frameworks can be found at:
- https://aka.ms/dotnet-download .
我的理解是.NET Core 3.0是向下兼容的。 為什么 Visual Studio 安裝程序安裝了除 2.2 以外的所有 .NET Core 版本? 我該如何解決這個問題?
In my case was missing x86 .NET Core 2.2.x Platform SDK (Visual Studio .NET 16.4 + .NET Core 3.1 SDK; xUnit Test Project).
你可以試試這個:
C:\Program Files (x86)\dotnet\shared\Microsoft.NETCore.App
?dotnet --info
正如@Martin 所說,您可以安裝 x86 .NET Core 2.2.x Platform SDK。
如果和我一樣不需要x86版本,也可以設置
<PlatformTarget>AnyCPU</PlatformTarget>
至
<PlatformTarget>x64</PlatformTarget>
在主項目和測試項目的 .csproj 文件中
以避免這個問題。
兩個選項是運行 Visual Studio 更新應用程序以查看是否會為您安裝任何缺少的要求,或者從https://dotnet.microsoft.com/download/dotnet-core/2.2 手動安裝 net core 2.2 SDK (或https://aka.ms/dotnet-download如錯誤消息中所述)。
因為您的計算機上沒有安裝 Asp.Net 核心運行時。 要安裝 2.2 版,您可以按照此 q&a的指南進行操作。
不再支持 .NET Core 2.2.0。 等待 .NET 5
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.