Target Framework missing in VS2017

Caerlica 1 Reputation point
2021-10-04T13:06:49.49+00:00

I have installed a new machine earlier this year, and turned out that I can no longer develop my old applications, because Target Framework Net Core 2.1. has disappeared from the dropdown list:

137320-image.png

My VS2017 version is 15.9.39
DotNet info shows installed versions:

.NET SDK (reflecting any global.json):  
 Version:   5.0.401  
 Commit:    4bef5f3dbf  
  
Runtime Environment:  
 OS Name:     Windows  
 OS Version:  10.0.19042  
 OS Platform: Windows  
 RID:         win10-x64  
 Base Path:   C:\Program Files\dotnet\sdk\5.0.401\  
  
Host (useful for support):  
  Version: 5.0.10  
  Commit:  e1825b4928  
  
.NET SDKs installed:  
  2.2.110 [C:\Program Files\dotnet\sdk]  
  3.1.413 [C:\Program Files\dotnet\sdk]  
  5.0.104 [C:\Program Files\dotnet\sdk]  
  5.0.204 [C:\Program Files\dotnet\sdk]  
  5.0.207 [C:\Program Files\dotnet\sdk]  
  5.0.303 [C:\Program Files\dotnet\sdk]  
  5.0.400 [C:\Program Files\dotnet\sdk]  
  5.0.401 [C:\Program Files\dotnet\sdk]  
  
.NET runtimes installed:  
  Microsoft.AspNetCore.All 2.1.29 [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.29 [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.18 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]  
  Microsoft.AspNetCore.App 3.1.19 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]  
  Microsoft.AspNetCore.App 5.0.4 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]  
  Microsoft.AspNetCore.App 5.0.5 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]  
  Microsoft.AspNetCore.App 5.0.9 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]  
  Microsoft.AspNetCore.App 5.0.10 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]  
  Microsoft.NETCore.App 2.1.29 [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.18 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]  
  Microsoft.NETCore.App 3.1.19 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]  
  Microsoft.NETCore.App 5.0.4 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]  
  Microsoft.NETCore.App 5.0.5 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]  
  Microsoft.NETCore.App 5.0.9 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]  
  Microsoft.NETCore.App 5.0.10 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]  
  Microsoft.WindowsDesktop.App 3.1.18 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]  
  Microsoft.WindowsDesktop.App 3.1.19 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]  
  Microsoft.WindowsDesktop.App 5.0.4 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]  
  Microsoft.WindowsDesktop.App 5.0.5 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]  
  Microsoft.WindowsDesktop.App 5.0.9 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]  
  Microsoft.WindowsDesktop.App 5.0.10 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]  

So what can I do? Newest Visual Studio and it does not work?

ASP.NET Core
ASP.NET Core
A set of technologies in the .NET Framework for building web applications and XML web services.
4,386 questions
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Zhi Lv - MSFT 32,101 Reputation points Microsoft Vendor
    2021-10-05T03:24:58.353+00:00

    Hi @Caerlica ,

    Target Framework Net Core 2.1. has disappeared from the dropdown list:

    You could try to re-install the Asp.net Core 2.1.

    Besides, you can also try to open the Visual Studio Installer, and click the "Modify", then in the popup model, select the "Individual components" tab, and checked the .Net Core 2.1 runtime. Finally, click the Modify button to update the Visual Studio. After modifying success, you will find the .net core 2.1 target framework in Visual Studio.

    137500-image.png


    If the answer is helpful, please click "Accept Answer" and upvote it.
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    Best regards,
    Dillion

    1 person found this answer helpful.
    0 comments No comments

  2. Michael Taylor 51,341 Reputation points
    2021-10-04T15:38:01.707+00:00

    Your .NET SDKs only shows .NET Core 2.2+ installed. Install the .NET Core 2.2 SDK and try again.

    It has been a while since I worked with VS2017 but I think at one point that class libraries had 2 different templates and one was for .NET Standard only. But I could be wrong. You might just be selecting the wrong template. If this is a console/windows app then you would expect to see the Core frameworks and not Standard (which they cannot run under.

    Of course if all else fails you can create as any target framework you want and then just change the framework inside the project file. This is a hack solution until you figure out what might be going wrong.

    0 comments No comments