简体   繁体   English

如何将所有解决方案项目 .Net framework 4.5.1 升级到 4.8 Visual Studio 2019

[英]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

4.7 4.7

4.8 and VS 2019 4.8 和 VS 2019

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.

相关问题 Visual Studio 2019 - 将 .NET 目标框架更改为 4.8 - Visual Studio 2019 - change .NET target framework to 4.8 在 Visual Studio 2019 / .NET Framework 4.8 中确定 C# 版本 - Determine C# version in Visual Studio 2019 / .NET Framework 4.8 .NET Framework 4.8 已安装但未在 Visual Studio 2019 社区中显示 - .NET Framework 4.8 is installed but not showing in Visual Studio 2019 community 如何在 Visual Studio 2019 中调试 .NET 5 WinForms 应用程序,该应用程序引用 .NET Framework 4.8 class 库 - Howto debug .NET 5 WinForms application that references .NET Framework 4.8 class library in Visual Studio 2019 Visual Studio 2019 中的解决方案显示 0 个项目 - Solution in Visual Studio 2019 shows 0 projects Visual Studio 2019 解决方案中的最大项目数量 - Maximum amount of projects in visual studio 2019 solution 使用.Net Framework v4.8和Visual Studio 2019查询TFS 2015源代码存储库DateTime属性 - Querying TFS 2015 Source Code Repository DateTime Properties with .Net Framework v4.8 and Visual Studio 2019 如何防止Visual Studio提示将项目.NET 4升级到.NET 4.5 - How to prevent Visual Studio to prompt to upgrade projects .NET 4 to .NET 4.5 如何将 Visual Studio 2019 中的 .NET 版本更改为 .NET Framework 4.7.2? - How to change .NET version in Visual Studio 2019 to .NET Framework 4.7.2? MSBuildWorkspace:解决方案在Visual Studio 2019上不包含任何文档和项目 - MSBuildWorkspace : solution contains no documents and no projects on Visual Studio 2019
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM