[英]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.我在 Visual Studio 2019 中有一个包含许多 C# 项目的解决方案。 I need to retarget all of the projects from the .NET Framework 4.5.1 to 4.8.
我需要将所有项目从 .NET Framework 4.5.1 重新定位到 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. PS:我尝试过“TargetFrameworkMigrator”,但它不适用于 (VS2019) / .net 4.8。
Thank you for your help.感谢您的帮助。
Relplace all occurances of替换所有出现的
<TargetFrameworkVersion>v4.5.1</TargetFrameworkVersion>
with和
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
in the all *.csproj files.在所有 *.csproj 文件中。 You can use Notepad++ for it.
您可以使用 Notepad++。
VS unfortunately doesn't provide an easy way for .NET framework, and every project file has it's own setting.不幸的是,VS 没有为 .NET 框架提供简单的方法,并且每个项目文件都有自己的设置。 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.
因此,最简单的方法可能是在 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"
).对于框架项目,在您想要的每个
.csproj
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
(来自<TargetFrameworkVersion>v4.5.1</TargetFrameworkVersion>
),如果您有任何packages.config
,则有targetFramework="net48"
(来自targetFramework="net451"
)。 You will need to reload the solution after changing for VS to see them.您需要在更改 VS 后重新加载解决方案才能看到它们。
So i gone through the PR's on Git, so you are not alone.所以我浏览了 Git 上的 PR,所以你并不孤单。 Someone has already posted a release package which works for
.NET 4.8
with VS2019
有人已经发布了一个发布包,它适用于
VS2019
.NET 4.8
Here is the OPEN PRs, which is waiting to be merged这是等待合并的 OPEN PRs
release for VS2019 which actually works, according to the commit and comments.根据提交和评论,VS2019 的版本实际上有效。 Give it a try
试一试
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.