前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >[C#] 记录:使用 .NET 升级助手将.NET Framework应用迁移到.NET 6

[C#] 记录:使用 .NET 升级助手将.NET Framework应用迁移到.NET 6

作者头像
科控物联
发布2022-03-29 17:38:17
1.1K0
发布2022-03-29 17:38:17
举报
文章被收录于专栏:科控自动化

在命令行下运行以下命令以安装 .NET 升级助手。(它是一个全局工具,因此您可以在任何地方运行该命令。)

代码语言:javascript
复制
dotnet tool install -g try-convert

如果已经安装try-convert但需要升级到较新版本,请执行以下命令:

代码语言:javascript
复制
dotnet tool update -g try-convert
安装 .NET 升级助手

我们现在已准备好安装 .NET 升级助手。为此,请从终端执行以下命令:

代码语言:javascript
复制
dotnet tool install -g upgrade-assistant
代码语言:javascript
复制
安装 .NET 升级助手后,切换到解决方案所在的文件夹并输入以下命令来运行它。
代码语言:javascript
复制
upgrade-assistantupgrade <****.sln>

upgrade-assistant upgrade ParaSet.sln 22-11-2021  15:44

Microsoft .NET Upgrade Assistant v0.3.256001+3c4e05c787f588e940fe73bfa78d7eedfe0190bd

We are interested in your feedback! Please use the following link to open a survey: https://aka.ms/DotNetUASurvey

[15:49:28 INF] Loaded 5 extensions

[15:49:29 INF] Using MSBuild from C:\Program Files\dotnet\sdk\6.0.100\

[15:49:29 INF] Using Visual Studio install from C:\Program Files\Microsoft Visual Studio\2022\Preview [v17]

[15:49:33 INF] Initializing upgrade step Select an entrypoint

Upgrade Steps

1. [Next step] Select an entrypoint

[15:49:33 INF] Recommending Windows TFM net6.0-windows because the project either has Windows-specific dependencies or builds to a WinExe

2. Select project to upgrade

Choose a command:

1. Apply next step (Select an entrypoint)

2. Skip next step (Select an entrypoint)

3. See more step details

4. Configure logging

5. Exit

> 1

[15:49:44 INF] Applying upgrade step Select an entrypoint

Please select the project you run. We will then analyze the dependencies and identify the recommended order to upgrade projects.

1. ParaSet

2. ParaSet_Net6

> 1

[15:49:49 INF] Upgrade step Select an entrypoint applied successfully

Please press enter to continue...

[15:50:02 INF] Recommending Windows TFM net6.0-windows because the project either has Windows-specific dependencies or builds to a WinExe

[15:50:02 INF] Recommending Windows TFM net6.0-windows because the project either has Windows-specific dependencies or builds to a WinExe

[15:50:02 INF] Recommending Windows TFM net6.0-windows because the project either has Windows-specific dependencies or builds to a WinExe

[15:50:02 INF] Initializing upgrade step Select project to upgrade

[15:50:02 INF] Recommending Windows TFM net6.0-windows because the project either has Windows-specific dependencies or builds to a WinExe

[15:50:02 INF] Recommending Windows TFM net6.0-windows because the project either has Windows-specific dependencies or builds to a WinExe

[15:50:02 INF] Initializing upgrade step Back up project

Upgrade Steps

Entrypoint: D:\ Csharp\排线盒子\ParaSet.csproj

Current Project: D:\ Csharp\排线盒子\ParaSet.csproj

1. [Next step] Back up project

2. Convert project file to SDK style

3. Clean up NuGet package references

4. Update TFM

5. Update NuGet Packages

6. Add template files

7. Update Winforms Project

a. Default Font API Alert

b. Winforms Source Updater

8. Upgrade app config files

a. Convert Application Settings

b. Convert Connection Strings

c. Disable unsupported configuration sections

9. Update source code

a. Apply fix for UA0002: Types should be upgraded

b. Apply fix for UA0012: 'UnsafeDeserialize()' does not exist

10. Move to next project

Choose a command:

1. Apply next step (Back up project)

2. Skip next step (Back up project)

3. See more step details

4. Select different project

5. Configure logging

6. Exit

> 1

[15:50:08 INF] Applying upgrade step Back up project

Please choose a backup path

1. Use default path [D:\ Csharp\排线盒子.backup]

2. Enter custom path

> 1

[15:50:16 INF] Backing up D:\ Csharp\排线盒子 to D:\ Csharp\排线盒子.backup\排线盒子

[15:50:16 WRN] Could not copy file D:\ Csharp\排线盒子\upgrade-assistant.clef due to 'The process cannot access the file 'D:\ Csharp\排线盒子\upgrade-assistant.clef' because it is being used by another process.'

[15:50:20 INF] Project backed up to D:\ Csharp\排线盒子.backup\排线盒子

[15:50:20 INF] Upgrade step Back up project applied successfully

Please press enter to continue...

[15:50:22 INF] Initializing upgrade step Convert project file to SDK style

[15:50:22 INF] Initializing upgrade step Clean up NuGet package references

[15:50:24 INF] Reference to .NET Upgrade Assistant analyzer package (Microsoft.DotNet.UpgradeAssistant.Extensions.Default.Analyzers, version 0.3.256001) needs to be added

[15:50:24 INF] Packages to be added: Microsoft.DotNet.UpgradeAssistant.Extensions.Default.Analyzers, Version=0.3.256001

Upgrade Steps

Entrypoint: D:\ Csharp\排线盒子\ParaSet.csproj

Current Project: D:\ Csharp\排线盒子\ParaSet.csproj

1. [Complete] Back up project

2. [Complete] Convert project file to SDK style

3. [Next step] Clean up NuGet package references

4. Update TFM

5. Update NuGet Packages

6. Add template files

7. Update Winforms Project

a. Default Font API Alert

b. Winforms Source Updater

8. Upgrade app config files

a. Convert Application Settings

b. Convert Connection Strings

c. Disable unsupported configuration sections

9. Update source code

a. Apply fix for UA0002: Types should be upgraded

b. Apply fix for UA0012: 'UnsafeDeserialize()' does not exist

10. Move to next project

Choose a command:

1. Apply next step (Clean up NuGet package references)

2. Skip next step (Clean up NuGet package references)

3. See more step details

4. Select different project

5. Configure logging

6. Exit

> 1

[15:50:34 INF] Applying upgrade step Clean up NuGet package references

[15:50:34 INF] Adding package reference: Microsoft.DotNet.UpgradeAssistant.Extensions.Default.Analyzers, Version=0.3.256001

[15:50:37 INF] Upgrade step Clean up NuGet package references applied successfully

Please press enter to continue...

[15:50:43 INF] Initializing upgrade step Update TFM

[15:50:43 INF] Recommending Windows TFM net6.0-windows because the project either has Windows-specific dependencies or builds to a WinExe

[15:50:43 INF] TFM needs updated to net6.0-windows

Upgrade Steps

Entrypoint: D:\ Csharp\排线盒子\ParaSet.csproj

Current Project: D:\ Csharp\排线盒子\ParaSet.csproj

1. [Complete] Back up project

2. [Complete] Convert project file to SDK style

3. [Complete] Clean up NuGet package references

4. [Next step] Update TFM

5. Update NuGet Packages

6. Add template files

7. Update Winforms Project

a. Default Font API Alert

b. Winforms Source Updater

8. Upgrade app config files

a. Convert Application Settings

b. Convert Connection Strings

c. Disable unsupported configuration sections

9. Update source code

a. Apply fix for UA0002: Types should be upgraded

b. Apply fix for UA0012: 'UnsafeDeserialize()' does not exist

10. Move to next project

Choose a command:

1. Apply next step (Update TFM)

2. Skip next step (Update TFM)

3. See more step details

4. Select different project

5. Configure logging

6. Exit

> 1

[15:50:48 INF] Applying upgrade step Update TFM

[15:50:48 INF] Recommending Windows TFM net6.0-windows because the project either has Windows-specific dependencies or builds to a WinExe

[15:50:51 INF] Updated TFM to net6.0-windows

[15:50:51 INF] Upgrade step Update TFM applied successfully

Please press enter to continue...

[15:50:54 INF] Initializing upgrade step Update NuGet Packages

[15:50:56 WRN] No version of MetroModernUI found that supports ["net6.0-windows"]; leaving unchanged

[15:50:56 INF] No package updates needed

[15:50:56 INF] Initializing upgrade step Add template files

[15:50:56 INF] 0 expected template items needed

[15:50:56 INF] Initializing upgrade step Update Winforms Project

[15:50:56 WRN] Default font in Windows Forms has been changed from Microsoft Sans Serif to Seg Segoe UI, in order to change the default font use the API - Application.SetDefaultFont(Font font). For more details see here - https://devblogs.microsoft.com/dotnet/whats-new-in-windows-forms-in-net-6-0-preview-5/#application-wide-default-font.

[15:50:56 WRN] HighDpiMode needs to set in Main() instead of app.config or app.manifest - Application.SetHighDpiMode(HighDpiMode.<setting>). It is recommended to use SystemAware as the HighDpiMode option for better results.

Upgrade Steps

Entrypoint: D:\ Csharp\排线盒子\ParaSet.csproj

Current Project: D:\ Csharp\排线盒子\ParaSet.csproj

1. [Complete] Back up project

2. [Complete] Convert project file to SDK style

3. [Complete] Clean up NuGet package references

4. [Complete] Update TFM

5. [Complete] Update NuGet Packages

6. [Complete] Add template files

7. Update Winforms Project

a. [Next step] Default Font API Alert

b. Winforms Source Updater

8. Upgrade app config files

a. Convert Application Settings

b. Convert Connection Strings

c. Disable unsupported configuration sections

9. Update source code

a. Apply fix for UA0002: Types should be upgraded

b. Apply fix for UA0012: 'UnsafeDeserialize()' does not exist

10. Move to next project

Choose a command:

1. Apply next step (Default Font API Alert)

2. Skip next step (Default Font API Alert)

3. See more step details

4. Select different project

5. Configure logging

6. Exit

> 1

[15:51:00 INF] Applying upgrade step Default Font API Alert

[15:51:00 WRN] Default font in Windows Forms has been changed from Microsoft Sans Serif to Seg Segoe UI, in order to change the default font use the API - Application.SetDefaultFont(Font font). For more details see here - https://devblogs.microsoft.com/dotnet/whats-new-in-windows-forms-in-net-6-0-preview-5/#application-wide-default-font.

[15:51:00 INF] Upgrade step Default Font API Alert applied successfully

Please press enter to continue...

Upgrade Steps

Entrypoint: D:\ Csharp\排线盒子\ParaSet.csproj

Current Project: D:\ Csharp\排线盒子\ParaSet.csproj

1. [Complete] Back up project

2. [Complete] Convert project file to SDK style

3. [Complete] Clean up NuGet package references

4. [Complete] Update TFM

5. [Complete] Update NuGet Packages

6. [Complete] Add template files

7. Update Winforms Project

a. [Complete] Default Font API Alert

b. [Next step] Winforms Source Updater

8. Upgrade app config files

a. Convert Application Settings

b. Convert Connection Strings

c. Disable unsupported configuration sections

9. Update source code

a. Apply fix for UA0002: Types should be upgraded

b. Apply fix for UA0012: 'UnsafeDeserialize()' does not exist

10. Move to next project

Choose a command:

1. Apply next step (Winforms Source Updater)

2. Skip next step (Winforms Source Updater)

3. See more step details

4. Select different project

5. Configure logging

6. Exit

> 1

[15:51:09 INF] Applying upgrade step Winforms Source Updater

[15:51:09 WRN] HighDpiMode needs to set in Main() instead of app.config or app.manifest - Application.SetHighDpiMode(HighDpiMode.<setting>). It is recommended to use SystemAware as the HighDpiMode option for better results.

[15:51:09 INF] Updated Program.cs file at D:\ Csharp\排线盒子\ParaSet\Program.cs with HighDPISetting set to SystemAware

[15:51:09 INF] Upgrade step Winforms Source Updater applied successfully

[15:51:09 INF] Applying upgrade step Update Winforms Project

[15:51:09 INF] Upgrade step Update Winforms Project applied successfully

Please press enter to continue...

[15:51:17 INF] Initializing upgrade step Upgrade app config files

[15:51:17 INF] Found 0 app settings for upgrade:

[15:51:17 INF] Found 0 connection strings for upgrade:

[15:51:17 INF] Initializing upgrade step Update source code

[15:51:17 INF] Running analyzers on ParaSet

[15:51:19 INF] Identified 0 diagnostics in project ParaSet

[15:51:19 INF] Initializing upgrade step Move to next project

Upgrade Steps

Entrypoint: D:\ Csharp\排线盒子\ParaSet.csproj

Current Project: D:\ Csharp\排线盒子\ParaSet.csproj

1. [Complete] Back up project

2. [Complete] Convert project file to SDK style

3. [Complete] Clean up NuGet package references

4. [Complete] Update TFM

5. [Complete] Update NuGet Packages

6. [Complete] Add template files

7. [Complete] Update Winforms Project

a. [Complete] Default Font API Alert

b. [Complete] Winforms Source Updater

8. [Complete] Upgrade app config files

a. [Complete] Convert Application Settings

b. [Complete] Convert Connection Strings

c. [Complete] Disable unsupported configuration sections

9. [Complete] Update source code

a. [Complete] Apply fix for UA0002: Types should be upgraded

b. [Complete] Apply fix for UA0012: 'UnsafeDeserialize()' does not exist

10. [Next step] Move to next project

Choose a command:

1. Apply next step (Move to next project)

2. Skip next step (Move to next project)

3. See more step details

4. Select different project

5. Configure logging

6. Exit

> 1

[15:51:23 INF] Applying upgrade step Move to next project

[15:51:23 INF] Upgrade step Move to next project applied successfully

Please press enter to continue...

[15:51:34 INF] Recommending Windows TFM net6.0-windows because the project either has Windows-specific dependencies or builds to a WinExe

[15:51:34 INF] Recommending Windows TFM net6.0-windows because the project either has Windows-specific dependencies or builds to a WinExe

[15:51:34 INF] Recommending Windows TFM net6.0-windows because the project either has Windows-specific dependencies or builds to a WinExe

[15:51:34 INF] Recommending Windows TFM net6.0-windows because the project either has Windows-specific dependencies or builds to a WinExe

[15:51:34 INF] Recommending Windows TFM net6.0-windows because the project either has Windows-specific dependencies or builds to a WinExe

[15:51:34 INF] Recommending Windows TFM net6.0-windows because the project either has Windows-specific dependencies or builds to a WinExe

[15:51:34 INF] Initializing upgrade step Finalize upgrade

Upgrade Steps

Entrypoint: D:\ Csharp\排线盒子\ParaSet.csproj

[15:51:34 INF] Recommending Windows TFM net6.0-windows because the project either has Windows-specific dependencies or builds to a WinExe

[15:51:34 INF] Recommending Windows TFM net6.0-windows because the project either has Windows-specific dependencies or builds to a WinExe

1. [Next step] Finalize upgrade

Choose a command:

1. Apply next step (Finalize upgrade)

2. Skip next step (Finalize upgrade)

3. See more step details

4. Configure logging

5. Exit

> 1

[15:51:37 INF] Applying upgrade step Finalize upgrade

[15:51:37 INF] Upgrade step Finalize upgrade applied successfully

Please press enter to continue...

[15:51:46 INF] Upgrade has completed. Please review any changes.

本文参与 腾讯云自媒体同步曝光计划,分享自微信公众号。
原始发表:2021-11-24,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 科控物联 微信公众号,前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体同步曝光计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
目录
  • 安装 .NET 升级助手
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档