Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

.NETCoreApp 2.0 option missing from "Target framework" dropdown of project properties, after installing 2.0

Tags:

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?

like image 928
voxoid Avatar asked Aug 19 '17 11:08

voxoid


2 Answers

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"
  }
}
like image 29
Serg.ID Avatar answered Oct 24 '22 13:10

Serg.ID


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>
like image 125
ironstone13 Avatar answered Oct 24 '22 12:10

ironstone13