Asp.net-Core

找不到指定的框架“Microsoft.AspNetCore.App”,版本“2.1.0”

  • May 29, 2018

我嘗試將我的網路應用程序從 .net core 2.0 升級到 .net core 2.1 我做了:

  1. 安裝 Visual Studio Professional 2017 Preview Version 15.8.0 Preview 1.1

  2. 從此處安裝 .net core 2.1.3 RC1 SDK:https ://www.microsoft.com/net/download/dotnet-core/sdk-2.1 .300-rc1

  3. 將我所有的 aspnetcore nuget 包更新到最新版本。

完成這兩件事後,當我開始我的項目時,我會看到這個螢幕:

HTTP 錯誤 502.5 - 程序失敗 此問題的常見原因:

The application process failed to start
The application process started but then stopped
The application process started but failed to listen on the configured port 

故障排除步驟:

Check the system event log for error messages
Enable logging the application process' stdout messages
Attach a debugger to the application process and inspect 

有關詳細資訊,請訪問: https ://go.microsoft.com/fwlink/?LinkID=808681

在 ASP.NET Core Web 伺服器的輸出視窗中,我得到了這個:

The specified framework 'Microsoft.AspNetCore.App', version '2.1.0' was not found.
 - Check application dependencies and target a framework version installed at:
     C:\Program Files\dotnet\
 - Installing .NET Core prerequisites might help resolve this problem:
     http://go.microsoft.com/fwlink/?LinkID=798306&clcid=0x409
 - The .NET Core framework and SDK can be installed from:
     https://aka.ms/dotnet-download
 - The following versions are installed:
     2.1.0-preview2-final at [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
     2.1.0-rc1-final at [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
It was not possible to find any compatible framework version
The specified framework 'Microsoft.AspNetCore.App', version '2.1.0' was not found.
 - Check application dependencies and target a framework version installed at:
     C:\Program Files\dotnet\
 - Installing .NET Core prerequisites might help resolve this problem:
     http://go.microsoft.com/fwlink/?LinkID=798306&clcid=0x409
 - The .NET Core framework and SDK can be installed from:
     https://aka.ms/dotnet-download
 - The following versions are installed:
     2.1.0-preview2-final at [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
     2.1.0-rc1-final at [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]

.NET Core 2.1 SDK 將於本週發布。如果您不能等到那時,請將其添加到您的 *.csproj

<Project Sdk="Microsoft.NET.Sdk.Web">
 <PropertyGroup>
   <TargetFramework>netcoreapp2.1</TargetFramework>
   <RestoreAdditionalProjectSources>
       https://dotnetfeed.blob.core.windows.net/orchestrated-release-2-1/20180515-07/final/index.json
   </RestoreAdditionalProjectSources>
 </PropertyGroup>
 
 ....
</Project>

並從以下網址下載最終 SDK:https ://dotnetcli.blob.core.windows.net/dotnet/Sdk/2.1.300/dotnet-sdk-2.1.300-win-x64.exe

更多詳情請訪問:https ://github.com/aspnet/Home/wiki/2.1.0-Early-Access-Downloads

引用自:https://stackoverflow.com/questions/50594020