2

I am running VS 15.6.1.

enter image description here

I have downloaded and ran the following two files:

  • dotnet-sdk-2.1.4-win-x64.exe
  • dotnet-runtime-2.0.5-win-x64.exe

Here's the contents of my C:\Program Files\dotnet\sdk

enter image description here

I created a new project as a .NET Core Class Library. But when I try to target it to Core 2.1,1, I can't:

enter image description here

This thread didn't help: .NET Core 2.0 missing from my Visual Studio

What am I doing wrong?

Casey Crookston
  • 13,016
  • 24
  • 107
  • 193
  • VS 15.6.1 is the latest and already includes Core 2.0 without a need to install any SDK. I have VS 15.6.0 and when I create a new .NET Core Class Library, it automatically defaults to Core 2.0. In the list of your last screenshot, you only have Core 1.0 and 1.1, but I also have 2.0 and I installed nothing other than VS. You cannot target 2.1.1 in that list, the max is 2.0 which is `netcoreapp2.0` in the project file. The 2.1.1 can be added in an additional package `Microsoft.AspNetCore.All`. – Racil Hilan Mar 13 '18 at 18:37
  • When I upgraded my VS from 15.1 to 15.6.1, it didn't seem to have Core. – Casey Crookston Mar 13 '18 at 18:40
  • No, it's hard to believe that this is the case. I don't want to upgrade right now, but I'm sure I won't lose Core 2.0 when I upgrade. – Racil Hilan Mar 13 '18 at 18:42
  • @CaseyCrookston did you *select* Core in the VS installer? Core 2.0 is already available out of the box. If you don't see it you probably didn't install it. I've been using .NET Core 2.0 for various projects for some time now – Panagiotis Kanavos Mar 13 '18 at 18:49

2 Answers2

2

Ok, I found the answer here: Configure .NET Core to use x86 SDK

But what is not listed in that answer is the location from which you can download the x86 version of the SDK. It's here:

https://www.microsoft.com/net/download/dotnet-core/sdk-2.1.4

So here's that I did:

  1. Close Visual Studio
  2. Un-install the x64 SDK (all versions of it)
  3. Manually remove all folders and files inside of C:\Program Files\dotnet\sdk
  4. Download and run the x86 version of the SDK
  5. Re-open Visual Studio. And bam....

enter image description here

Casey Crookston
  • 13,016
  • 24
  • 107
  • 193
  • The Core 2.0 option in your screenshot has nothing to do with the SDK that you installed. I have it in my VS 15.6.0 without installing any SDK. When you installed the x64 SDK, you lost the Core 2.0 in the list, so uninstalling it was the solution for you to get the Core 2.0 option back. – Racil Hilan Mar 13 '18 at 18:43
  • 2.1 is a *preview*. Core 2.0 is already available in VS 2017 Update 6. I'm using it for several projects. Did you select it in the installer? – Panagiotis Kanavos Mar 13 '18 at 18:49
  • @PanagiotisKanavos 2.1 is not a preview, it is actually included in VS2017 Update 6 along with Core 2.0 as you said. Type `dotnet --version` in command line to see what you have. On my VS15.6.0, I get `2.1.100` without installing any package. – Racil Hilan Mar 13 '18 at 19:00
  • But even after I updated from 15.1 to 15.6, there were NO .Core options available. – Casey Crookston Mar 13 '18 at 19:00
  • 1
    It's hard to tell, but perhaps there was an error during the installation or you didn't select the required options. If you run the installer, make sure the correct options are selected, and run it, you should get Core 2.0, but there is no need to go through all of that since you have it fixed now. – Racil Hilan Mar 13 '18 at 19:04
  • I've just upgraded to the new 15.6.2 and now my Core version is 2.1.101, and still have Core 2.0 in the target list. – Racil Hilan Mar 13 '18 at 21:24
  • @RacilHilan .NET Core 2.1 is a preview that was just [released only a couple of weeks ago](https://blogs.msdn.microsoft.com/dotnet/2018/02/27/announcing-net-core-2-1-preview-1/) – Panagiotis Kanavos Mar 13 '18 at 21:30
  • @PanagiotisKanavos Two weeks is a long time in the life of a butterfly :). Please note that we're talking here about the SDK, not the runtime which your link is about. Today the latest SDK is 2.1.101 and runtime is 2.0.6, and previews are SDK 2.1.300 and runtime 2.1.0. You can see them [here](https://www.microsoft.com/net/download/all). Even though the runtime 2.1 is still a preview, it is recommended to use the latest SDK 2.1.101 according to the security advisory [CVE-2018-0875](https://docs.microsoft.com/en-ca/visualstudio/releasenotes/vs2017-relnotes#15.6.2). That's why I upgraded VS ;). – Racil Hilan Mar 13 '18 at 22:04
1

The preceding answer works but it's not the right way to fix the problem. See The latest installed .NET SDK not found which is the MS supported answer and explains why this failed.

RickAndMSFT
  • 20,912
  • 8
  • 60
  • 78
  • Thanks! I'm glad you spoke up and provided the correct way to solve this. As both the OP and the owner of the other answer, I marked this one as correct. – Casey Crookston Apr 13 '21 at 17:38