将 .NET Framework 4.8 迁移到 .NET 5 [英] Migrate .NET Framework 4.8 to .NET 5

查看:303
本文介绍了将 .NET Framework 4.8 迁移到 .NET 5的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

最近微软发布了.NET 5.如果我们想将.NET Framework 4.8升级到.net 5,那么我们如何完成这个任务.

请注意:

  1. 我已经使用所有最新版本升级了 Visual Studio 18.2组件和 .net Framework 5. 但在项目属性 .net 中5 不显示.

  2. 我的应用程序在 .net Framework 中,而不是在 .net core 中.

2021 年 2 月 2 日更新我在微软论坛上发过同样的问题,幸运的是他们的回答非常积极.

https://developercommunity2.visualstudio.com/t/net-framework-48-upgrade-to-net-5/1269991?from=email&viewtype=all#T-ND1352565

2021 年 8 月更新

来自微软的消息

我们将通过在 GitHub 存储库中发布的预览继续改进 .NET 升级助手.你可以在这里找到它:https://github.com/dotnet/upgrade-assistant>

升级快乐!

解决方案

您没有提到您的项目的类型.但总的来说,您应该遵循官方文档.例如,对于 winforms 项目,请参阅 How to将 Windows 窗体桌面应用迁移到 .NET 5.

很可能,首先,您需要手动编辑您的项目文件并将其更改为 SDK 样式,如以上文章所述:

<属性组>...</PropertyGroup></项目>

Recently Microsoft has release .NET 5. If we want to upgrade .NET Framework 4.8 to .net 5 then how can we accomplish this task.

Please Note :

  1. I had already upgrade Visual Studio 18.2 with all latest component and .net Framework 5. But in project property .net 5 is not displayed.

  2. My application is in .net Framework not in .net core.

Update Feb 02, 2021 Same Question I had posted on Microsoft Forum and luckily they replied very positively.

https://developercommunity2.visualstudio.com/t/net-framework-48-upgrade-to-net-5/1269991?from=email&viewtype=all#T-ND1352565

Update August 2021

Message from Microsoft

We’ll continue to make the .NET Upgrade Assistant better through previews that will coming out in the GitHub repo. You can find it here: https://github.com/dotnet/upgrade-assistant

Happy upgrading!

解决方案

You didn't mention what's the type of your project. But in general, you should follow the official docs. For example, for winforms projects, see How to migrate a Windows Forms desktop app to .NET 5.

Most likely, as the first thing, you will need to edit your project file manually and change it to the SDK style, as described in the article above:

<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
   ...
  </PropertyGroup>

</Project>

这篇关于将 .NET Framework 4.8 迁移到 .NET 5的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆