21

I had a .NETCoreApp 1.1 Console App created in Visual Studio 2017 Community, and wish to upgrade it to 2.0.0 (so I can use Microsoft.AspNetCore.WebSockets 2.0.0). In project properties, I expand the "Target frameworks" dropdown, select "Install other frameworks...", download .NET Core 64-bit, complete the installer, restart visual studio, but the 2.0 framework is still not available from the dropdown; only 1.0 and 1.1.

I also tried installing the 32-bit version, and then the main Core 2.0 SDK (64-bit). Still no option. I also tried manually editing the project file to point everything to 2.0, but then I get build errors, and the dropdown selection is blank and the 2.0 option still not there.

What is the proper way to make 2.0 a target framework?

Mark Amery
  • 143,130
  • 81
  • 406
  • 459
voxoid
  • 1,164
  • 1
  • 14
  • 31

3 Answers3

18

You might need to update your visual studio Version 15.3.0 and install .NET Core 2.0 SDK - then you should be able to see all your options in Target Framework the drop-down.

If you have installed all the updates above, and you still don't see it, try the following.

Edit your *.csproj file and set your target framework to the proper value <TargetFramework>netcoreapp2.0</TargetFramework> like below.

Keep in mind that you have to update your NuGet packages afterward, by running Update-Package from your NuGet Package Manager Console

<Project Sdk="Microsoft.NET.Sdk.Web">

  <PropertyGroup>
    <TargetFramework>netcoreapp2.0</TargetFramework>
    <PackageTargetFallback>$(PackageTargetFallback);portable-net45+win8+wp8+wpa81;</PackageTargetFallback>
    <DockerComposeProjectPath>..\docker-compose.dcproj</DockerComposeProjectPath>
  </PropertyGroup>
ironstone13
  • 3,325
  • 18
  • 24
  • Yes, installing version 15.3.1 of Visual Studio 2017 (currently the latest) solved the problem (then came back and found your answer :) ). This latest version of VS cannot be auto-updated because the updater must be updated, so you have to download the installer directly https://www.visualstudio.com/downloads/ . I had already manually installed .NET Core 2.0 so I'm not sure if it is also packaged with the new version of VS; one may still need to download it separately if it doesn't show up in the dropdown. – voxoid Aug 19 '17 at 13:48
  • In Visual Studio 2017, you can click on View --> Notifications to get to the update button. Here's a useful reference link: https://learn.microsoft.com/en-us/visualstudio/install/update-visual-studio – Dan Csharpster Dec 13 '17 at 16:05
5

If manual adjustment didn't help check your project for global.json file, if it exists -> check SDK version. It was 1.0.4 in my case, replace with 2.0.0 -> close/re-open your solution, check available target frameworks. The answer is from this link

{
  "sdk": {
    "version": "1.0.4"
  }
}
vcsjones
  • 138,677
  • 31
  • 291
  • 286
Serg.ID
  • 1,604
  • 1
  • 21
  • 25
0

You have to open Visual Studio Installer and bellow 'Visual Studio X 2017' click the Update Button.

Once I did this, now I have .Net core 2.0 available.

Alexa Adrian
  • 1,778
  • 2
  • 23
  • 38