利用.NET Upgrade Assitant对项目进行升级

本教程演示如何把WPF程序从 <TargetFrameworkVersion>v4.8 </TargetFrameworkVersion>升级到<TargetFramework>net8.0-windows</TargetFramework>.

下载并安装.NET Upgrade Assistant - Visual Studio Marketplace

Supported .NET upgrades:

  • .NET Framework to .NET 6+ (including .NET 9.0 Preview)
  • .NET Core to .NET 6+ (including .NET 9.0 Preview)
  • Any .NET version to .NET 6+ (including .NET 9.0 Preview) that is higher than the current version
  • Azure Functions v1, v2, v3 to v4 isolated (targeting net6.0 or net7.0)
  • Xamarin.Forms to MAUI
    • Note: For Xamarin->MAUI .xaml file transformations the Upgrade Assistant includes basic namespace replacements. More comprehensive .xaml file transformations require Visual Studio 17.6.

Supported project types:

  • ASP.NET
  • Azure Functions
  • WPF
  • WinForms
  • Class libraries
  • Console
  • Xamarin.Forms
  • .NET MAUI
  • UWP

Coming soon:

  • WCF to WCF Core upgrade

以上更新信息可在.NET Upgrade Assistant - Visual Studio Marketplace中获取到。

安装过程会默认勾选已安装的Visual Studio版本,我本机用的vs2022 Community版本。

安装成功后,打开你的项目,右击选择项目进行升级。

具体步骤如下图所示:

建议更新到LTS版本。

需要一个项目一个项目的升级,升级完成后如果出现引用错误,可重新添加项目间的引用,然后Clean下Solution,rebuild即可。

PS:Upgrade总共有三种方式,可根据自己项目情况进行选择。默认推荐In-place project upgrade。

相关推荐
Aevget2 小时前
界面控件DevExpress WinForms中文教程:Data Grid - 数据绑定(二)
.net·界面控件·winform·devexpress·ui开发
码农刚子5 小时前
.NET 权限系统(RBAC)怎么设计?直接可复用
后端·.net
喵叔哟7 小时前
4. 【Blazor全栈开发实战指南】--Blazor开发环境搭建
微服务·.net
csdn_aspnet9 小时前
使用 C# 和 Microsoft Agent Framework 构建 AI 代理
人工智能·microsoft·ai·c#·.net·agent·ai agent
SEO_juper9 小时前
XML Sitemap 详解:作用、意义与创建必要性
xml·.net·seo·数字营销·2026
武藤一雄10 小时前
告别繁琐的 out 参数:C# 现代元组(ValueTuple)如何重构你的方法返回值
microsoft·c#·asp.net·.net·.netcore
从入门到放弃-咖啡豆11 小时前
Alibaba Cloud Linux 部署.NET 8 环境 项目运行
linux·服务器·.net·.net core
唐青枫12 小时前
C#.NET Memory 深入解析:跨异步边界的内存视图与高性能实战
c#·.net
波波00712 小时前
.NET 多线程任务的几种实现方式全解析
.net
波波00712 小时前
每日一题:请解释 .NET 中的协变和逆变?
后端·.net