Home > OS >  Visual Studio 2019 - change .NET target framework to 4.8
Visual Studio 2019 - change .NET target framework to 4.8

Time:10-18

I cannot change the .NET version of my project. I installed .NET 4.8 via the Visual studio installer and manually downloaded it separately. Neither of these works.

I actually tried to change the framework in the .csproj project file

<TargetFramework> net5.0-windows </TargetFramework> 

to

<TargetFramework>net48</TargetFramework>

and it doesn't work too... I'm running out of solutions and don't really know what to do next.

target framework pic

CodePudding user response:

Have you tried to add .net 4.8 component to VS2019?

CodePudding user response:

If you're attempting to convert an SDK-style "net5.0-windows" project to a "net48" WinForms one you'll likely need to do more than just change TargetFramework.

Firstly, the Project node at the start of the ".csproj" file should look like this:

<Project Sdk="Microsoft.NET.Sdk.WindowsDesktop">

(A "net5.0" target doesn't need the .WindowsDesktop part of that.)

Secondly, you'll need to ensure that <UseWindowsForms>true</UseWindowsForms> is part of the main PropertyGroup.

  • Related