The current .NET SDK does not support targeting .NET Core 2.1. Either target .NET Core 2.0 or lower, or use a .NET SDK that supports .NET Core 2.1

后端 未结 15 2537
攒了一身酷
攒了一身酷 2020-12-13 23:13

have tried upgrading to the professional version of visual studio 2017 v 15.6.0 (Preview 7.0)

and installed aspnetcore-runtime-2.1.0-preview1-final-win-x64 and .net

15条回答
  •  忘掉有多难
    2020-12-13 23:42

    I am using Rider, I had

    The current .NET SDK does not support targeting .NET Core 2.2. Either target .NET Core 2.1 or lower, or use a version of the .NET SDK that supports .NET Core 2.2

    I had:

    $ dotnet --list-sdks
    2.1.2 [C:\Program Files\dotnet\sdk]
    2.1.202 [C:\Program Files\dotnet\sdk]
    2.1.505 [C:\Program Files\dotnet\sdk]
    2.1.602 [C:\Program Files\dotnet\sdk]
    2.2.202 [C:\Program Files\dotnet\sdk]
    

    I tried keeping only the latest sdk, and had:

    Project 'WebApplication3' load failed: The SDK 'Microsoft.NET.Sdk.Web' specified could not be found..

    So I removed everything and reinstalled 2.1.602. Made a new project from Rider. And it worked. Cannot say I understood how I solved it...

    The issues for some peoples seems to be linked to global.json, see:
    - https://docs.microsoft.com/fr-fr/aspnet/core/migration/21-to-22?view=aspnetcore-2.2&tabs=visual-studio
    - https://docs.microsoft.com/fr-fr/dotnet/core/tools/global-json
    - https://andrewlock.net/the-sdk-microsoft-net-sdk-web-specified-could-not-be-found/

    Other things I did before (that did not seem to solve the issue but might have helped?):
    - Updating Rider from 2018.3.2 to 2018.3.4 (latest). - Installing Mono (was using the one from Unity when look into Rider build settings).
    - Tried to use custom MSBuild from Jetbrain (the one used for Linux) without success.
    - Installing everything related to .NET Core from VS installer.
    - Update VS community ot latest. - Reboot.

    In Rider/Build, Execution, Deployement/Toolset and Build I now have:
    Mono executable: C:\Program Files\Mono\bin\mono.exe
    - NET Core CLI executable: C:\Program Files\dotnet\dotnet.exe
    - Use MS Build version (Auto detected 16.0): C:\Program - Files\dotnet\sdk\2.1.602\MSBuild.dll

提交回复
热议问题