development

현재 .NET SDK는 .NET Core 2.1 대상 지정을 지원하지 않습니다.

big-blog 2020. 11. 7. 10:47
반응형

현재 .NET SDK는 .NET Core 2.1 대상 지정을 지원하지 않습니다. .NET Core 2.0 이하를 대상으로하거나 .NET Core 2.1을 지원하는 .NET SDK를 사용합니다.


Visual Studio 2017 v 15.6.0 (Preview 7.0)의 전문가 버전으로 업그레이드하려고했습니다.

aspnetcore-runtime-2.1.0-preview1-final-win-x64 및 .net core SDK 2.1.4를 설치했습니다.

새 웹 응용 프로그램을 만들 때 다음과 같은 오류가 발생합니다.

"현재 .NET SDK는 .NET Core 2.1 대상 지정을 지원하지 않습니다. 대상 .NET Core 2.0 이하 또는 .NET Core 2.1을 지원하는 .NET SDK 버전을 사용하십시오."

기존 프로젝트를 빌드하려고하면 오류가 발생합니다.

"현재 .NET SDK는 .NET Core 2.1 대상 지정을 지원하지 않습니다. 대상 .NET Core 2.0 이하 또는 .NET Core 2.1을 지원하는 .NET SDK 버전을 사용하십시오."

대상 프레임 워크에 ".net core 2.1"이 표시되지 않습니다.

내 컴퓨터에 global.json 파일이 없습니다.

dotnet --info를 시도하면 다음이 표시됩니다.

c : \ source \ dnacloud \ testapp> dotnet --info .NET 명령 줄 도구 (2.1.100)

Product Information:
Version: 2.1.100
Commit SHA-1 hash: b9e74c6

Runtime Environment:
OS Name: Windows
OS Version: 10.0.16299
OS Platform: Windows
RID: win10-x64
Base Path: C:\Program Files\dotnet\sdk\2.1.100\

Microsoft .NET Core Shared Framework Host

Version : 2.0.5
Build : 17373eb129b3b05aa18ece963f8795d65ef8ea54

여기서 문제는 Microsoft가 .NET Core SDK의 번호를 매기는 방법과 많은 사람들을 혼동했다는 것입니다.

원본 포스터의 메시지에서 경로 C : \ Program Files \ dotnet \ sdk \ 2.1.100 \은 .NET Core 2.1 런타임을 나타내는 것으로 보이지 않습니다 (하지만 그렇게 생각할 것입니다).

이 게시물을 보았습니다 . 현재 .NET SDK는 Microsoft 지원 담당자가 혼란을 설명하는 developercommunity.visualstudio.com에서 .NET Core 2.1대상으로 지정하는 것을 지원하지 않습니다 .

"의견을 보내 주셔서 감사합니다.이 문제는 버그가 아니라는 것을 확인했습니다. .NET Core 2.1을 지원하는 첫 번째 SDK는 2.1.300-preview1입니다. 버전 관리가 혼란 스럽기 때문에 2.1.300부터 이제 SDK의 major.minor 버전이 런타임의 major.minor 버전과도 정렬됩니다. "

그래서 ... SDK를 통한 빌드를위한 .NET Core 2.1 지원을 받으려면 최소한 버전 2.1.300으로 SDK를 설치해야합니다 (2.1.2는 .NET Core 2.1이 아니기 때문에) ... 네, 혼란 스럽습니다. 이것에 대해 시간을 잃어버린 Microsoft에 감사드립니다.


2.2.100-preview3-009430을 설치 한 다음 Visual Studio 15.9.2로 업데이트 한 후 이런 일이 발생했습니다.

".NET Core SDK의 미리보기 사용"옵션을 활성화하여 해결했습니다.

  1. 이동 : 도구> 옵션> 프로젝트 및 솔루션> .NET Core

  2. ".NET Core SDK의 미리보기 사용"상자를 선택합니다.

  3. Visual Studio를 다시 시작하고 솔루션을 다시 빌드합니다.

VS 미리보기 옵션


설치 .NET Core SDK 2.1.300-preview2가 나를 위해 트릭을했습니다.

업데이트 : 최근에 새로운 버전이 출시 된 경우를 대비하여. 당신은 (ASP.NET 2.2.0-preview1 포함) 2.2.0-preview1에 대한 새로운 .NET 핵심 SDK 다운로드 할 수 있습니다 여기를 .

일반적으로 다음과 같은 오류가 발생하면 답변을 참조하십시오 .

현재 .NET SDK는 .NET Core 2.X 대상 지정을 지원하지 않습니다.


문제를 해결했습니다. 원인은 내가 설치했기 때문입니다

  • aspnetcore-runtime-2.1.0-preview1-final-win-x64
  • .net core SDK 2.1.4-x64 버전.
  • 설치는 sdk 파일을 c:\Program Files\dotnet
  • 하지만 VS2017 32bit는 c:\Program Files(x86)\dotnet.

이 문제를 해결하려면

  • x86 버전의 sdk 및 aspnetcore 런타임을 설치했습니다.

  • 새 설치 경로를 가리 키도록 MSBuildSDKsPath 환경 변수를 설정합니다.

  • 제어판에서 사용하지 않는 모든 sdk를 삭제했습니다.

VS2017 업데이트 3 'Microsoft.NET.Sdk.Web' 질문 은이 문제를 해결하는 데 도움이 될 수 없습니다 .


https://www.microsoft.com/net/download/visual-studio-sdks

위 사이트에서 SDK를 다운로드 할 수 있습니다.

컴퓨터 경로 C : \ Program Files \ dotnet \ sdk에있는 SDK를 확인하십시오.

Visual Studio에서 대상 프레임 워크 변경 또는 확인,

시작 응용 프로그램 또는 프로젝트 => 응용 프로그램 => 대상 프레임 워크를 마우스 오른쪽 버튼으로 클릭합니다.

프레임 워크를 변경하고 솔루션을 빌드하고 너깃 패키지를 복원 할 수 있습니다.

enter image description here


나에게도 똑같은 일이 발생했지만 .NET Core 버전 2.2에서 발생했습니다. 당시 2.2.202였던 .NET Core 2.2 SDK의 최신 버전을 설치했습니다. Visual Studio를 사용하여 Core 2.2에 대한 새 프로젝트를 만들 수 있었지만 오류가 표시되었습니다.

"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."

The target framework for my project was empty and the dropdown didn't show 2.2.

After installing .NET Core SDK 2.2.103, the error was gone and the dropdown did show ".NET Core 2.2".


Stopping IIS for publishing solved the problem. But first I needed to install net core 2.1 SDK and update the Visual Studio.


I had the .Net Core SDK 2.1.4 installed and followed the other answers in this post without solving my problem. What finally did it for me was installing .Net Core SDK version 2.1.301, and uninstalling every other version. Seems like the SDK 2.1.4 cannot target .Net Core 2.1 but SDK 2.1.301 does the job.


Check to make sure you don't have global.json file in your project root folder that forces your project to use .NET SDK 2.1 only.

If you have this global.json file, delete it, and then restart visual studio.

As embarrassing as it might sound, I spent almost an hour tinkering and I even downloaded several SDK version to force it to use 2.2


It looks like Microsoft are encouraging better coding practice for those early adopters of latest development software in Net Core 2.1 by removing the capability to use older software where bad habits prevail. Net Core 2.0 and the older versions are almost end of life so should not be being used at all. (https://blogs.msdn.microsoft.com/dotnet/2018/06/20/net-core-2-0-will-reach-end-of-life-on-september-1-2018/)

1) Microsoft have removed ServiceLocator since widely considered an anti-pattern resulting in difficult to understand code.

2) To improve MVC applications, the AccountController was removed from Authentication/Authorization to encourage use of Razor pages which implement the Single Responsibiity Principle.

It would not be considered best practice to circumvent these changes in order to increase perpetuation of software built to lower software engineering standards in the past.


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


I started getting this error after I installed SDK 2.2.300. After reading this post and some other I downgrade it to SDK 2.2.1xx and the error went away. Note: I had to uninstall SDK 2.2.300 and restart after installing SDK 2.2.1xx.

참고URL : https://stackoverflow.com/questions/49171623/the-current-net-sdk-does-not-support-targeting-net-core-2-1-either-target-ne

반응형