如何将所有解决方案项目

如何将所有解决方案项目

本文介绍了如何将所有解决方案项目 .Net framework 4.5.1 升级到 4.8 Visual Studio 2019的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 Visual Studio 2019 中有一个包含许多 C# 项目的解决方案.我需要将所有项目从 .NET Framework 4.5.1 重新定位到 4.8.是否可以立即更改目标,还是必须对每个目标单独进行更改?

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:我尝试过TargetFrameworkMigrator",但它不适用于 (VS2019)/.net 4.8.

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

感谢您的帮助.

推荐答案

不幸的是,VS 没有为 .NET 框架提供简单的方法,并且每个项目文件都有自己的设置.所以最简单的方法可能是在VS或任何你喜欢的文本编辑器中的目录上编辑->查找和替换->在文件中替换".

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.

对于框架项目,在每个 .csproj 中你需要 (来自 v4.5.1</TargetFrameworkVersion>),如果您有任何 packages.config,则有 targetFramework="net48"(来自 targetFramework="net451").您需要在更改后重新加载解决方案以让 VS 看到它们.

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.

这篇关于如何将所有解决方案项目 .Net framework 4.5.1 升级到 4.8 Visual Studio 2019的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-20 18:41