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

相关推荐
weixin_456904276 小时前
基于.NET Framework 4.0的串口通信
开发语言·c#·.net
yuyuyui8 小时前
Roslyn 技术解析:如何利用它做代码规范检查与运行时代码生成?
.net
IDOlaoluo14 小时前
如何安装 NDP48-x86-x64-AllOS-ENU.exe | .NET Framework 4.8 离线安装教程
.net
追逐时光者15 小时前
使用 Visual Studio 快速创建 NuGet 程序包并发布到 NuGet 官网
后端·.net·visual studio
焚 城19 小时前
.net8.0_webapi 生成二维码
.net
焚 城19 小时前
.NET 程序自动更新的回忆总结
.net
云草桑19 小时前
.net AI MCP 入门 适用于模型上下文协议的 C# SDK 简介(MCP)
ai·c#·.net·mcp
CsharpDev-奶豆哥1 天前
ASP.NET中for和foreach使用指南
windows·microsoft·c#·asp.net·.net
weixin_456904272 天前
C# 串口通信完整教程 (.NET Framework 4.0)
网络·c#·.net
追逐时光者2 天前
C#/.NET/.NET Core技术前沿周刊 | 第 57 期(2025年10.1-10.12)
后端·.net