Search code examples
c#migrationvisual-studio-2019.net-4.8

How to upgrade all solution projects .Net framework 4.5.1 to 4.8 Visual Studio 2019


I have a solution in Visual Studio 2019 with many C # projects. I need to retarget all of the projects from the .NET Framework 4.5.1 to 4.8. Is it possible to change target at once or do I have to do it separately with every single one of them?

PS: I tried 'TargetFrameworkMigrator', but it doesn't work with (VS2019) / .net 4.8.

Thank you for your help.


Solution

  • VS unfortunately doesn't provide an easy way for .NET framework, and every project file has it's own setting. So the easiest way is probably a "Edit -> Find and Replace- > Replace in Files" on the directory in VS or any text editor you like.

    For Framework projects, in every .csproj you want <TargetFrameworkVersion>v4.8</TargetFrameworkVersion> (from <TargetFrameworkVersion>v4.5.1</TargetFrameworkVersion>), if you have any packages.config, there is targetFramework="net48" (from targetFramework="net451"). You will need to reload the solution after changing for VS to see them.