question

Caerlica-8158 avatar image
0 Votes"
Caerlica-8158 asked ZhiLv-MSFT answered

Target Framework missing in VS2017

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?

dotnet-aspnet-core-general
image.png (7.2 KiB)
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

cooldadtx avatar image
0 Votes"
cooldadtx answered

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.

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

ZhiLv-MSFT avatar image
0 Votes"
ZhiLv-MSFT answered

Hi @Caerlica-8158,

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


image.png (100.7 KiB)
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.