Lower Target Framework unavailable

ansalc 451 Reputation points
2021-09-13T13:19:28.303+00:00

I wrote programs with VS 2019 on VB and C# that targeted the .NET 4.7.2 framework

On a new computer where I have VS 2019 as well, the target frameworks available are .NET 5.0 and .NET Core

How can I set VS 2019 on this new computer to target .NET 4.7.2 framework ?

I have installed the developer pack for .NET 4.7.2 found at https://dotnet.microsoft.com/download/visual-studio-sdks?utm_source=getdotnetsdk&utm_medium=referral on this new computer

However, .NET 4.7.2 still does not show as available in VS 2019 Project Properties/ Application / Target Framework

Developer technologies | .NET | .NET Runtime
0 comments No comments
{count} votes

Answer accepted by question author
  1. Xingyu Zhao-MSFT 5,381 Reputation points
    2021-09-14T02:00:36.77+00:00

    Hi @ansalc ,

    As suggested by Castorix31, make sure the project template you create is .NET Framework instead of .NET Core(or .NET5), and you cannot directly change the 'Target Framework' from .NET Core to .NET Framework.

    Besides, you can refer to the following document to determine if. Net framework 4.7.2 is installed.
    How to: Determine which .NET Framework versions are installed

    Hope it could be helpful.

    Best Regards,
    Xingyu Zhao
    *
    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.


3 additional answers

Sort by: Most helpful
  1. Bruce (SqlWork.com) 82,146 Reputation points Volunteer Moderator
    2021-09-13T20:06:33.63+00:00

    run visual studio installer, pick vs 2019 modify. then pick asp.net and web development.

    on the right, under Installation Details, select the out dated frameworks you want.


  2. Castorix31 91,511 Reputation points
    2021-09-13T20:43:43.743+00:00

    When you create a new project, do you choose the .NET Framework template, like :

    131732-netframework-template.jpg


  3. Marcin 1 Reputation point
    2023-02-14T12:44:35.57+00:00

    I also struggled with the same issue. I've figured out this solution works for me great for .NET 4.x, .NET 5 and .NET 7 on multiple OSes:

    <PropertyGroup>
      <FrameworkDescription>$([System.Runtime.InteropServices.RuntimeInformation]::FrameworkDescription.ToLower())</FrameworkDescription>
      <TargetFramework Condition="$(FrameworkDescription.Contains('net 7'))">net7</TargetFramework>
      <TargetFramework Condition="$(FrameworkDescription.Contains('net 6'))">net6</TargetFramework>
      <TargetFramework Condition="$(FrameworkDescription.Contains('net 5'))">net5</TargetFramework>
      <TargetFramework Condition="$(FrameworkDescription.Contains('mono'))">net461</TargetFramework>
    </PropertyGroup>
    
    
    0 comments No comments

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.