.net standard compatibility - .net-core

According to this page, .NET Core 2.1.15 is compatible with .NET standard 2.0. We have an application that had projects with the above versions and it worked, but when we loaded it again recently, we received the following error:
The current .NET SDK does not support targeting .NET Standard 2.0. Either target .NET Standard 1.6 or lower, or use a version of the .NET SDK that supports .NET Standard 2.0.
Our app MUST use SDK ver 2.1.803 (defined in global.json) and .net core 2.1.15 (Also specified in appsettings).
Here are my installed .net versions:
C:\Windows\system32>dotnet --info .NET Core SDK (reflecting any
global.json): Version: 2.2.109 Commit: 586f23c400
Runtime Environment: OS Name: Windows OS Version: 10.0.17134
OS Platform: Windows RID: win10-x64 Base Path: C:\Program
Files\dotnet\sdk\2.2.109\
Host (useful for support): Version: 2.2.7 Commit: b1e29ae826
.NET Core SDKs installed:
2.1.202 [C:\Program Files\dotnet\sdk]
2.1.505 [C:\Program Files\dotnet\sdk]
2.1.511 [C:\Program Files\dotnet\sdk]
2.1.803 [C:\Program Files\dotnet\sdk]
2.2.109 [C:\Program Files\dotnet\sdk]
.NET Core runtimes installed: Microsoft.AspNetCore.All 2.1.9
[C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.All 2.1.15 [C:\Program
Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.All 2.2.7 [C:\Program
Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.App 2.1.9 [C:\Program
Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 2.1.15 [C:\Program
Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 2.2.7 [C:\Program
Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.NETCore.App
2.0.9 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 2.1.9 [C:\Program
Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App
2.1.15 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 2.2.7 [C:\Program
Files\dotnet\shared\Microsoft.NETCore.App]
To install additional .NET Core runtimes or SDKs:
https://aka.ms/dotnet-download
We tried the following:
Uninstalled all .net core and sdk versions that were not 2.1.15 and 2.1.803 respectively,
Updated VS 2017 to the latest version
Downgraded to .NET Standard 1.6, but we had a lot of features that were not available to this version
Added .NET Standard nuget package back and updated all .NET Standard projects to use it, but received a similar message: SDK incompatibility.
So my questions are:
How do I know what .NET standard version is installed on my machine?
Did anyone experience this issue before?
Thanks
Alex

VS 2019 resolved the issue. It is the only IDE to work with .net Core 2.1.15 and SDK 2.1.803

Related

What is the meaning of 'Host (useful for support)' in output of 'dotnet --info'

Output from dotnet --info:
.NET Core SDK (reflecting any global.json):
Version: 3.1.416
Commit: 8d3765c609
Runtime Environment:
OS Name: Windows
OS Version: 10.0.19044
OS Platform: Windows
RID: win10-x64
Base Path: C:\Program Files\dotnet\sdk\3.1.416\
Host (useful for support):
Version: 5.0.13
Commit: b3afe99225
.NET SDKs installed:
3.1.416 [C:\Program Files\dotnet\sdk]
5.0.404 [C:\Program Files\dotnet\sdk]
.NET runtimes installed:
Microsoft.AspNetCore.App 3.1.22 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 5.0.13 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.NETCore.App 3.1.22 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 5.0.13 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.WindowsDesktop.App 3.1.22 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 5.0.13 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
To install additional .NET runtimes or SDKs:
https://aka.ms/dotnet-download
What does 'Host (useful for support) Version 5.0.13' mean here?
I have a global.json to specify that I want to use 3.1.416:
global.json:
{
"sdk": {
"version": "3.1.416",
"rollForward": "disable"
}
}
But this 'Host (useful for support)' seems to indicate that I am using 5.0.13 after all.
So, you already knew that on a single machine multiple .NET Core SDK can be installed, like 3.1 and 5.0 on yours.
They both install to a common place C:\Program Files\dotnet\sdk, but there is a single dotnet.exe executable, which usually comes from the newest .NET Core SDK installation, which is the "Host" in your context.
When you set the desired SDK version in global.json, the 5.0 Host is smart enough to redirect all actual commands (like dotnet build) to utilize the 3.1 SDK bits.

Error when trying to install dotnet tools

I'm trying to install Microsoft.dotnet-interactive tool but have this issue,
Also tried with different tools same issue
I tried the following commands
dotnet tool install --global Microsoft.dotnet-interactive
dotnet tool install --global Microsoft.dotnet-interactive --version 1.0.110520
dotnet tool install --global Microsoft.dotnet-interactive --version 1.0.115407
dotnet tool install --global dotnet-interactive
dotnet tool install --global dotnet-interactive --version 1.0.115407
Failed to install tool package 'microsoft.dotnet-interactive': Could not find a part of the path 'C:\Users\*\.dotnet\tools\.store\.stage\mfbifbk3.jlo\microsoft.dotnet-interactive'.
Tool 'microsoft.dotnet-interactive' failed to install. This failure may have been caused by:
You are attempting to install a preview release and did not use the --version option to specify the version.
A package by this name was found, but it was not a .NET Core tool.
The required NuGet feed cannot be accessed, perhaps because of an Internet connection problem.
You mistyped the name of the tool.
For more reasons, including package naming enforcement, visit https://aka.ms/failure-installing-tool
dotnet --info
.NET Core SDK (reflecting any global.json):
Version: 3.1.201
Commit: b1768b4ae7
Runtime Environment:
OS Name: Windows
OS Version: 10.0.18362
OS Platform: Windows
RID: win10-x64
Base Path: C:\Program Files\dotnet\sdk\3.1.201\
Host (useful for support):
Version: 3.1.3
Commit: 4a9f85e9f8
.NET Core SDKs installed:
2.1.604 [C:\Program Files\dotnet\sdk]
2.1.802 [C:\Program Files\dotnet\sdk]
3.1.100 [C:\Program Files\dotnet\sdk]
3.1.201 [C:\Program Files\dotnet\sdk]
.NET Core runtimes installed:
Microsoft.AspNetCore.All 2.1.11 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.All 2.1.13 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.All 2.1.14 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.App 2.1.11 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 2.1.13 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 2.1.14 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 3.1.0 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 3.1.3 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.NETCore.App 2.1.11 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 2.1.13 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 2.1.14 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 3.1.0 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 3.1.3 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.WindowsDesktop.App 3.1.0 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 3.1.3 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
To install additional .NET Core runtimes or SDKs:
https://aka.ms/dotnet-download
Any idea?
Thank you
For what it's worth, you are not quite running the latest of .NET Core SDK version (or runtime): if you are able on your particular machine, install the latest version (depending on your version of Visual Studio). This might cure your problem.
https://dotnet.microsoft.com/download
My configuration via dotnet --info, as the tools install correctly on Visual Studio 2019. If you have updated your .NET Core then the other major difference is the Windows version; not sure that would be significant:
.NET Core SDK (reflecting any global.json):
Version: 3.1.201
Commit: b1768b4ae7
Runtime Environment:
OS Name: Windows
OS Version: 10.0.19041
OS Platform: Windows
RID: win10-x64
Base Path: C:\Program Files\dotnet\sdk\3.1.201\
Host (useful for support):
Version: 3.1.3
Commit: 4a9f85e9f8
.NET Core SDKs installed:
2.1.511 [C:\Program Files\dotnet\sdk]
2.1.513 [C:\Program Files\dotnet\sdk]
3.1.100 [C:\Program Files\dotnet\sdk]
3.1.201 [C:\Program Files\dotnet\sdk]
.NET Core runtimes installed:
Microsoft.AspNetCore.All 2.1.15 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.All 2.1.17 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.App 2.1.15 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 2.1.17 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 3.1.0 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 3.1.3 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.NETCore.App 2.1.15 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 2.1.17 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 3.1.0 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 3.1.3 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.WindowsDesktop.App 3.1.0 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 3.1.3 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]

After updated Visual Studio 2019 to 16.4.0 I can't run tests with target framework 2.2

I have updated Visual studio 2019 to version 16.4.0. This version includes .NET Core SDK 3.1.100.
After that, I have tried to run some Unit Tests that I have on a project with Target Framework 2.2 but it's not being able to do so.
It gives the following error:
Microsoft.VisualStudio.TestPlatform.ObjectModel.TestPlatformException: Testhost process exited with error: It was not possible to find any compatible framework version
The framework 'Microsoft.AspNetCore.App', version '2.2.0' was not found.
- The following frameworks were found:
3.1.0 at [C:\Program Files (x86)\dotnet\shared\Microsoft.AspNetCore.App]
You can resolve the problem by installing the specified framework and/or SDK.
If I go to the aforementioned path I only found a 3.1.0 folder.
If I list the installed SDKS I get this:
dotnet --list-sdks
2.1.602 [C:\Program Files\dotnet\sdk]
2.1.700 [C:\Program Files\dotnet\sdk]
2.1.701 [C:\Program Files\dotnet\sdk]
2.1.801 [C:\Program Files\dotnet\sdk]
2.1.802 [C:\Program Files\dotnet\sdk]
2.2.100 [C:\Program Files\dotnet\sdk]
2.2.202 [C:\Program Files\dotnet\sdk]
2.2.207 [C:\Program Files\dotnet\sdk]
2.2.300 [C:\Program Files\dotnet\sdk]
2.2.301 [C:\Program Files\dotnet\sdk]
2.2.401 [C:\Program Files\dotnet\sdk]
2.2.402 [C:\Program Files\dotnet\sdk]
3.1.100 [C:\Program Files\dotnet\sdk]
If I ask for the installed runtimes I get this:
dotnet --list-runtimes
Microsoft.AspNetCore.All 2.1.9 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.All 2.1.11 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.All 2.1.12 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.All 2.1.13 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.All 2.2.0 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.All 2.2.3 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.All 2.2.5 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.All 2.2.6 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.All 2.2.7 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.All 2.2.8 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.App 2.1.9 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 2.1.11 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 2.1.12 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 2.1.13 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 2.2.0 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 2.2.3 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 2.2.5 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 2.2.6 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 2.2.7 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 2.2.8 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 3.1.0 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.NETCore.App 2.1.9 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 2.1.11 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 2.1.12 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 2.1.13 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 2.2.0 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 2.2.3 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 2.2.5 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 2.2.6 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 2.2.7 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 2.2.8 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 3.1.0 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.WindowsDesktop.App 3.1.0 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
So, I see Microsoft.AspNetCore.App', version '2.2.0' installed on the listed runtimes.
On the other hand, If I do: 'dotnet test' on the Unit Test project from within the Package Manager Console the tests are being run.
I also have Visual Studio Code installed and without any change, I can even Debug those Tests.
So, I'm a little bit lost here and I have tried for instance to manually copy the 2.2.0 Folder from C:\Program Files\dotnet\shared\ but after that, I got other errors while trying to run the tests.
Could anyone help me or point me in the right direction.
After looking at the solution from #coloradoeos I discovered a different way to solve this without needing to install an x86 version.
Simply go to Test > Process architecture for anyCPU projects > x64
Tests should run normally after selecting x64.
I'll refer you to this link.
The root cause appeared to be the lack of an x86 .NET Core 2.2 SDK instance under the following directory "C:\Program Files (x86)\dotnet\shared\Microsoft.NETCore.App".
I only had a 3.1 version present, so I specifically downloaded an x86 version of the 2.2 SDK and installed it. Once I did that, the testhost ran my unit tests from Visual Studio (VS) just fine. I never uninstalled the old version of the SDK, so this must be an issue with the update process for the framework/VS.
If you have the same issue in Azure build pipeline.
change the target platform from in your test project to X64.
Visual Studio was configured to run AnyCPU tests as x86, but only the x64 SDK was installed. set VS to use x64 for AnyCPU tests.
Also
Upgraded to Microsoft.NET.Test.Sdk to the latest version.
And also in my case, I had to add a specific .NET core version to build pipeline.
Find specific .NET core version Here
Try changing project framework to the ones that are found i.e 3.1 or 5.0: Right click on project -> Properties -> Application -> Target framework

Why is dotnet build not using the specified SDK on global.json?

I have a global.json with the following contents
{
"sdk": {
"version": "2.2.300"
}
}
This is the output of dotnet --list-sdks
2.0.3 [C:\Program Files\dotnet\sdk]
2.1.105 [C:\Program Files\dotnet\sdk]
2.1.300 [C:\Program Files\dotnet\sdk]
2.2.300 [C:\Program Files\dotnet\sdk]
This is the output of donet --list-runtimes
Microsoft.AspNetCore.All 2.1.0 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.All 2.2.5 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.App 2.1.0 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 2.2.5 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.NETCore.App 2.0.3 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 2.0.7 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 2.1.0 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 2.2.5 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Yet when I do dotnet build I get the following error
Microsoft (R) Build Engine version 16.1.76+g14b0a930a7 for .NET Core
Copyright (C) Microsoft Corporation. All rights reserved.
C:\Program
Files\dotnet\sdk\2.1.300\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.TargetFrameworkInference.targets(137,5):
error : 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.
[C:\solutionfolder\projectfolder\Project.csproj]
C:\Program
Files\dotnet\sdk\2.1.300\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.TargetFrameworkInference.targets(137,5):
error : 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.
[C:\solutionfolder\projectfolder\Project.csproj]
Build FAILED.
C:\Program
Files\dotnet\sdk\2.1.300\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.TargetFrameworkInference.targets(137,5):
error : 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.
[C:\solutionfolder\otherprojectfolder\OtherProject.csproj]
C:\Program
Files\dotnet\sdk\2.1.300\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.TargetFrameworkInference.targets(137,5):
error : 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.
[C:\solutionfolder\otherprojectfolder\OtherProject.csproj]
0 Warning(s)
2 Error(s)
I need help, this is driving me nuts
Ok, found the solution, it seems this Environment System Variable
MSBuildSDKsPath was pointing to the .NET Core 2.1.300 Sdks folder, removing that variable addressed the problem.

dotnet SDK 2.2.104 don't compile .NET Core 2.2

I have a .NET Sdk version 2.1 and lower.
I installed sdk2.2 and sdk3.
I removed sdk3
Now, the VS17 build and test my solution successfully.
But from the command line, with dotnet-cli, I can't compile the solution, because he says he is sdk2.1.
dotnet build:
C:\Program Files\dotnet\sdk\2.1.500\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.TargetFrameworkInference.targets(137,5): error NETSDK1045: 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. [C:\Users\.......\WebApi.csproj]
Build FAILED.
dotnet --info:
.NET Core SDK (reflecting any global.json):
Version: 2.2.104
Commit: 73f036d4ac
Runtime Environment:
OS Name: Windows
OS Version: 10.0.17763
OS Platform: Windows
RID: win10-x64
Base Path: C:\Program Files\dotnet\sdk\2.2.104\
Host (useful for support):
Version: 2.2.2
Commit: a4fd7b2c84
.NET Core SDKs installed:
2.1.500 [C:\Program Files\dotnet\sdk]
2.2.104 [C:\Program Files\dotnet\sdk]
.NET Core runtimes installed:
Microsoft.AspNetCore.All 2.1.5 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.All 2.2.2 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.App 2.1.5 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 2.2.2 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.NETCore.App 2.1.5 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 2.2.2 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
WebApi.csproj:
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>netcoreapp2.2</TargetFramework>
.
.
.
</PropertyGroup>
</Project>
Thanks to livarcocc, we know the issue is in MSBuildSDKsPath environment variable, who still points to sdk2.1.
For fix the problem, we need to retarget the MSBuildSDKsPath to the SDK version we want, or completely remove this variable.
Before:
set MSBuildSDKsPath
MSBuildSDKsPath=C:\Program Files\dotnet\sdk\2.1.500\Sdks
After:
set MSBuildSDKsPath
MSBuildSDKsPath=C:\Program Files\dotnet\sdk\2.2.104\Sdks

Resources