利用.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。

相关推荐
阿捞232 分钟前
在 .NET 中使用 Moonshot Kimi + AgentFramework:从 SDK 到 Agent 的完整实践
html·.net·xhtml
步步为营DotNet1 小时前
解锁.NET 11 中 Microsoft.Extensions.AI 在智能后端开发的深度应用
人工智能·microsoft·.net
无风听海1 小时前
.NET10之C# 中的is null深入理解
服务器·c#·.net
bjzhang751 小时前
FastReport——一个面向.NET生态的开源报表引擎
.net·fastreport
武藤一雄17 小时前
C# 异常(Exception)处理避坑指南
windows·microsoft·c#·.net·.netcore·鲁棒性
步步为营DotNet17 小时前
剖析.NET 11 中 Native AOT 在高性能客户端应用的极致实践
.net
步步为营DotNet19 小时前
深度探索.NET Aspire在云原生应用性能与安全加固的创新实践
安全·云原生·.net
我是唐青枫21 小时前
C#.NET TPL Dataflow 深入解析:数据流管道、背压控制与实战取舍
c#·.net
无风听海1 天前
.NET10之ControllerContext与ActionDescriptor深度解析
.net
fqrj20261 天前
公司网站设计制作费用详解:影响价格的关键因素
microsoft·.net·网站建设