The specified framework 'Microsoft.AspNetCore.

2019-02-16 05:11发布

I tried to upgrade my web app from .net core 2.0 to .net core 2.1 I did:

1) Install Visual Studio Professional 2017 Preview Version 15.8.0 Preview 1.1
2) Installed the .net core 2.1.3 RC1 SDK from here: https://www.microsoft.com/net/download/dotnet-core/sdk-2.1.300-rc1
3) Updated all of my aspnetcore nuget packages to the latest version.

After doing both of these things, when I start my project I get this screen:

HTTP Error 502.5 - Process Failure Common causes of this issue:

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 

Troubleshooting steps:

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

For more information visit: https://go.microsoft.com/fwlink/?LinkID=808681

and in my Output window from ASP.NET Core Web Server, I get this:

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]

4条回答
兄弟一词,经得起流年.
2楼-- · 2019-02-16 05:24

.NET Core SDK 2.1.300 is now available: https://www.microsoft.com/net/download/windows Install it, this fixed the problem for me.

查看更多
太酷不给撩
3楼-- · 2019-02-16 05:26

Looks like it's available on chocolatey now https://chocolatey.org/packages/dotnetcore-sdk/2.1.300

Not yet on the normal dotnet distribution sites. Crazy.

查看更多
ら.Afraid
4楼-- · 2019-02-16 05:36

By updating all NuGet packages you seem to have upgraded from the RC version you started out with (which is installed on your system) to the RTM version currently being released (and thus already available on NuGet but not installed on your system).

The Microsoft.AspNetCore.App NuGet packages is supposed to be referenced without a version so that the installed tooling can pick an appropriate version.

Update your .csproj file to remove the Version attribute and only reference that package through:

<ItemGroup>
  <PackageReference Include="Microsoft.AspNetCore.App" />
</ItemGroup>
查看更多
Bombasti
5楼-- · 2019-02-16 05:39

.NET Core 2.1 SDK will be released this week. If you can't wait until then, add this to your *.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>

And download the final SDK from: https://dotnetcli.blob.core.windows.net/dotnet/Sdk/2.1.300/dotnet-sdk-2.1.300-win-x64.exe

For more details visit: https://github.com/aspnet/Home/wiki/2.1.0-Early-Access-Downloads

查看更多
登录 后发表回答