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

Kyl*_*yle 27 .net-core asp.net-core asp.net-core-2.0

我试图将我的网络应用程序从.net core 2.0升级到.net core 2.1我做了:

1)安装Visual Studio Professional 2017预览版15.8.0预览版1.1
2)从这里安装.net核心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 
Run Code Online (Sandbox Code Playgroud)

故障排除步骤

Check the system event log for error messages
Enable logging the application process' stdout messages
Attach a debugger to the application process and inspect 
Run Code Online (Sandbox Code Playgroud)

有关详细信息,请访问:https: //go.microsoft.com/fwlink/?LinkID = 808681

在我的ASP.NET核心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]
Run Code Online (Sandbox Code Playgroud)

小智 10

.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>
Run Code Online (Sandbox Code Playgroud)

并从以下网址下载最终的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


Mar*_*ich 8

通过更新所有似乎已从开始的RC版本(已安装在系统上)的RC版本升级到当前正在发布的RTM版本(因此已在NuGet上可用,但尚未安装在系统上)已升级。

Microsoft.AspNetCore.App的NuGet包应该没有版本被引用,所以安装工具可以选择一个合适的版本。

更新您的.csproj文件以删除Version属性,并仅通过以下方式引用该程序包:

<ItemGroup>
  <PackageReference Include="Microsoft.AspNetCore.App" />
</ItemGroup>
Run Code Online (Sandbox Code Playgroud)

  • “应该被引用而没有版本”我不同意这一说法。此外,您的建议不起作用,因为Microsoft.AspNetCore.App NuGet程序包不包含下限。我的建议是等待最终的.NET SDK 2.1.300安装程序可用于安装最新的ASP.NET Core 2.1位。 (2认同)

sat*_*ite 5

.NET Core SDK 2.1.300 现已可用:https : //www.microsoft.com/net/download/windows安装它,这为我解决了问题。