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.
Right-click on your project. Select Properties. Select the Application tab. Change the Target Framework to the desired framework.
NET Framework version. To update the target framework for all projects, right-click on the project (one by one), click properties, and from the “Application” tab change the target framework to the desired one as in the following screenshot and select “Yes” in the popup that is displayed after the framework is changed.
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.
Target Framework Migrator is now available for the Visual Studio 2019 and .Net 4.8. Unfortunately does not work for Core or .Net 5 / 6 ...
Keep in mind that tpdating the XML node <TargetFrameworkVersion>
value with a text editor sounds fair solution, consider that the old format of the .csproj file also stores the target framework versions of the nuget dependencies and these should be updated to reduce possibilities of unexpected runtime errors.
After updating the projects target framework, you should reinstall all nuget packages. VS will tell this, but you can check this as well: How to reinstall NuGet packages
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With