0

We are on Visual Studio Pro 2019, so I need to convert a project from .NET 5 to .NET Framework 4.7.2. Using this post, I was able to make the project recognize the framework version. I tried both styles, but only the second worked:

<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
<TargetFramework>net472</TargetFramework>

I'm getting an error when implementing it:

Error NETSDK1013
The TargetFramework value '' was not recognized. It may be misspelled. If not, then the TargetFrameworkIdentifier and/or TargetFrameworkVersion properties must be specified explicitly. ProjectName C:\Program Files\dotnet\sdk\5.0.411\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.TargetFrameworkInference.targets 92

I assume that it should be pointing to a different SDK altogether based on the file path, but I haven't found anywhere in the project or solution that does that.

It would be nice to also be able to use the old framework style of publishing as well, but I would prefer not to have to start with a new project if I can help it.

4.7.2 publish page

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
Josh
  • 40
  • 1
  • 5
  • MAybe unrelated, but worth checking in advance: have you actually installed the .NET Framework 4.7.2 SDK ? https://dotnet.microsoft.com/en-us/download/visual-studio-sdks (select developer pack for the 4.7.2) – Pac0 Sep 28 '22 at 20:41
  • 1
    "We are on Visual Studio Pro 2019, so I need to convert a project from .NET 5 to .NET Framework 4.7.2" - Why? Visual Studio supports .NET 5+ – Luke Sep 28 '22 at 20:43
  • @Pac0 - Yes, I use 4.7.2 for most other projects. – Josh Sep 28 '22 at 20:51
  • @Luke - .NET 5 is at end of life, and VS2019 doesn't support .NET 6+ – Josh Sep 28 '22 at 20:52
  • Don't know the exact answer, but give this a look: https://learn.microsoft.com/en-us/dotnet/standard/frameworks – Kit Sep 28 '22 at 22:02
  • You're right, I meant .NET 5, not +. But .NET 5 is supported in build 16.8.0. I guess the better question is why would you downgrade an entire assembly to 4.7.2 just to support an old IDE, rather than update to VS2022? – Luke Sep 28 '22 at 23:30

0 Answers0