How to changing the default Framework to 4.8 in Visual Studio 2022, when creating project

Som Prakash Tiwari 1 Reputation point
2022-03-10T07:30:58.533+00:00

I installed the Visual Studio 2022, when I am creating the .NET Framework project on Configure your new project Dialog page of Visual Studio, by default selected Framework is coming .NET 4.7.2.
I want, when I create the new project by default .NET 4.8 should be selected in place of .NET 4.7.2.

Thanks in advance.

Regards,
Som

Not Monitored
Not Monitored
Tag not monitored by Microsoft.
40,143 questions
{count} votes

3 answers

Sort by: Most helpful
  1. RLWA32 45,866 Reputation points
    2022-03-10T12:01:31.367+00:00

    When creating a new VB .Net Framework project select Framework Version 4.8 and create your project. Afterwards, the "Configure your new project dialog" in VS2022 will then open with Framework Version 4.8 when creating a new .Net Framework project.

    1 person found this answer helpful.
    0 comments No comments

  2. Som Prakash Tiwari 1 Reputation point
    2022-03-10T12:06:55.06+00:00

    Thanks.
    I seen this behavior. But want to know where I can set so first time also it will come as 4.8. As i am working on Visual Studio Extension and want user when create the project using the custom template will get 4.8 option by default fist time itself.


  3. Tianyu Sun-MSFT 31,511 Reputation points Microsoft Vendor
    2022-03-14T05:50:02.533+00:00

    Hi @Som Prakash Tiwari ,

    Thanks for your reply.

    The <TargetFrameworkVersion>v$targetframeworkversion$</TargetFrameworkVersion> MSBuild code line will get and set the target framework which selected by customer in the drop down list of the Framework box. So the default version of the target framework should be stored in another folder/Registry… I remember, for previous versions of VS, this default version of target framework was stored in Registry > NewProjectdIALOG > FxVersion value, but it does not work for VS 2022.

    I checked the .NET APIs and also didn’t find the corresponding method to get and set this default target framework. You may need to consider other ways to set the target framework version of your custom template. Or I suggest you also try to ask VS Product Team on our Developer Community and confirm if it is possible to change the default target framework in a custom extension of project template.

    Best Regards,
    Tianyu

    • If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
      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.
    0 comments No comments

Your answer

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