Another one of those many many similar issues, yet none of the solutions searched for, helped (see below which one are looked at).
At the moment of writing this, .NE
Adding @martin-ullrich's answer from https://github.com/aspnet/AspNetCore.Docs/issues/11844, because it made more sense to me. (Maybe 'cuz it's Friday, and I just needed: "Go here and do this.")
Go to https://dotnet.microsoft.com/download/dotnet-core/2.2 and download the installer for the 2.2.105 version. Anything >= 2.2.200 will not work in VS 2017. Both 2.2.105 and 2.2.202 contain the latest and greatest .NET Core 2.2 version but they differ in the version of the tools they include and are based on - the 1xx train is MSBuild 15., NuGet 4. etc. and the 2xx train is MSBuild 16., NuGet 5. and so on and Visual Studio only looks for the latest version compatible with its version of MSBuild - for VS 2017 this is 2.1.502 version which cannot target .NET Core 2.2. (And to add more confusion, there are now 2.1.6xx versions with VS 2019 tool versions together with the .NET Core 2.1 runtime)
[@]leecow and [@]rowanmiller are working on updating that page regarding VS, also see dotnet/core#2542 and dotnet/sdk#3076 which are about the same problem.
My contribution: After installing 2.2.105, I deleted the folder(s) titled '2.2.202' in directory C:\Program Files (x86)\dotnet\sdk
and/or C:\Program Files\dotnet\sdk
so that dotnet --info
now reads the following:
Installing dotnet-sdk-2.2.103-win-x64 fixed the issue
This most likely looks like an installer optimisation for VS that removes old SDKs being too greedy and remove versions that older VS versions rely on, but at the moment this is more of an hypothesis while MS teams are investigating. See this GitHub issue for more similar reports.
The 2.2.1xx SDK(!) versions use MSBuild 15 and the 2.2.2xx use MSBuild 16.
VS 2017 needs to resolve a local version that is compatible with MSBuild 15 so if 2.2.1xx was removed during an upgrade, this may fail.
You can fix this by re-installing a compatible version - e.g. 2.2.105 - from https://dotnet.microsoft.com/download/dotnet-core/2.2
In order to find out which SDK uses which components, you can check the DependencyVersions.props file in the <3.0 sources and the Versions.props file for >= 3.0 (preview) sources - MSBuild version is set in via the MicrosoftBuildPackageVersion
property.
Use Visual Studio 2019 instead of 2017 if you want work with asp.net core version more then v2.2.100 https://github.com/aspnet/AspNetCore.Docs/issues/11844
If you are using Visual Studio 2017 (v15.9) you need to install .NET Core SDK version 2.2.108 as greater versions is supported only in Visual Studio 2019.
See the table below to select the correct download.
Check also release information and download links here