2

I have already installed .NET Framework 4.7.2 as shown in the screenshot below. But when I create a new project (or try to add a new project within an existing solution), the target type for .NET Framework 4.7.2 is not shown (shown in the second screenshot below).

enter image description here

PROBLEM: .NET Framework 4.7.2 is not present in the target framework

enter image description here

Guru Stron
  • 102,774
  • 10
  • 95
  • 132
skm
  • 5,015
  • 8
  • 43
  • 104

1 Answers1

7

When creating an application be sure to select correct template - Class Library (.NET Framework):

enter image description here

You have selected a template targeting .NET (i.e. .NET Core) or .NET Standard. Note that .NET Framework 4.7.2 supports .NET Standard 2.0 (see the docs), so you can create .NET Standard 2.0 library and reference it in a .NET Framework project.

Guru Stron
  • 102,774
  • 10
  • 95
  • 132
  • wow! I was expecting to get the full list just by selecting class library. If they are specifying Class Library (.NET Framework) then, the another one should be specified as Class Library (.NET). Thanks a lot for the answer :) – skm Dec 19 '22 at 11:25
  • 2
    @skm .NET is the new name of .NET Core. You have to explicitly look for `.NET Framework` projects – Panagiotis Kanavos Dec 19 '22 at 11:29
  • @PanagiotisKanavos: Yes, I know that .NET Core is the new name. That's why I said that some how it needs to be specified. If you selecting only "Class Library", you would expect that the differentiation would be done later (at least that's what I expected). – skm Dec 19 '22 at 11:48
  • @skm it can't, because the structure of the `csproj` file is different (and the entire build system). The old format required specifying everything explicitly, both settings and files. The new format uses defaults for most settings and all code files are included by default. Visual Studio uses the same templates that `dotnet new` uses so it can't mix up such completely different project types – Panagiotis Kanavos Dec 19 '22 at 13:05