本ブログはアフィリエイト広告を利用しています。

.NET Core 3.1 から upgrade-assistant を使用して.NET 6.0にアップグレードする

framework version プログラミング

アップグレードするプロジェクト

アップグレード対象は.NET Core 3.1 で開発したものを使用します。
以前、バージョンを.NET 6.0に変更しようとしたときはビルドエラーが出たので再チャレンジです。
ちなみにその時はエラーの内容すら見ていません。単純に.NET Core 3.1から.NET 6.0に変えただけでその他の設定等はエラー見てないので修正する気もなかったです。
それではアップグレードしていきます。

アップグレードアシスタントをインストール

ソリューションエクスプローラでソリューションを右クリックしてメニューから “ターミナルで開く” を選択します。
開いたターミナルで “dotnet tool install -g upgrade-assistant” でアップグレードアシスタントをインストールします。

> dotnet tool install -g upgrade-assistant

.NET 7.0 へようこそ!
---------------------
SDK バージョン: 7.0.200

テレメトリ
---------
.NET ツールは、エクスペリエンスの向上のために利用状況データを収集します。データは Microsoft によって収集され、コミュニティと共有されます。テレメトリをオプトアウトするには、好みのシェルを使用して、DOTNET_CLI_TELEMETRY_OPTOUT 環境変数を '1'  または 'true' に設定できます。

.NET CLI ツールのテレメトリの詳細をご覧ください: https://aka.ms/dotnet-cli-telemetry

----------------
ASP.NET Core の HTTPS 開発証明書をインストールしました。
証明書を信頼するには、'dotnet dev-certs https --trust' (Windows および macOS のみ) を実行します。
HTTPS の詳細については、https://aka.ms/dotnet-https を参照してください
----------------
最初のアプリを作成するには、https://aka.ms/dotnet-hello-world を参照してください
最新情報については、https://aka.ms/dotnet-whats-new を参照してください
ドキュメントを探索するには、https://aka.ms/dotnet-docs を参照してください
GitHub で問題の報告とソースの検索を行うには、https://github.com/dotnet/core を参照してください
'dotnet --help' を使用して使用可能なコマンドを確認するか、https://aka.ms/dotnet-cli にアクセスしてください
--------------------------------------------------------------------------------------
次のコマンドを使用してツールを呼び出せます。upgrade-assistant
ツール 'upgrade-assistant' (バージョン '0.4.410601') が正常にインストールされました。

インストールが完了したらドライランを実行するコマンドがあるようなのでまずはお試しで実行してみます。

> upgrade-assistant analyze sinoalice-event-loop.sln
-----------------------------------------------------------------------------------------------------------------
Microsoft .NET Upgrade Assistant v0.4.410601+6304b1d0784e32e20ef0299db22bc9e3f6a9b3f3

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

[19:11:23 INF] Loaded 9 extensions

Telemetry
----------
The .NET tools collect usage data in order to help us improve your experience. The data is collected by Microsoft and shared with the community. You can opt-out of telemetry by setting the DOTNET_UPGRADEASSISTANT_TELEMETRY_OPTOUT environment variable to '1' or 'true' using your favorite shell.

Read more about Upgrade Assistant telemetry: https://aka.ms/upgrade-assistant-telemetry
Read more about .NET CLI Tools telemetry: https://aka.ms/dotnet-cli-telemetry

[19:11:27 INF] Using MSBuild from C:\Program Files\dotnet\sdk\7.0.200\
[19:11:27 INF] Using Visual Studio install from C:\Program Files\Microsoft Visual Studio\2022\Community [v17]
[19:11:34 INF] Writing output to C:\gomibako\net-upgrade\sinoalice-event-loop\AnalysisReport.sarif
[19:11:36 INF] Recommending Windows TFM net7.0-windows for project sinoalice-event-loop.csproj because the project either has Windows-specific dependencies or builds to a WinExe
[19:11:37 INF] Reference to .NET Upgrade Assistant analyzer package (Microsoft.DotNet.UpgradeAssistant.Extensions.Default.Analyzers, version 0.4.410601) needs to be added
[19:11:39 INF] Adding Microsoft.Windows.Compatibility 7.0.0 helps with speeding up the upgrade process for Windows-based APIs
[19:11:45 INF] Running analyzers on sinoalice-event-loop
[19:11:47 INF] Identified 0 diagnostics in project sinoalice-event-loop
[19:11:47 INF] Analysis Complete, the report is available at C:\gomibako\net-upgrade\sinoalice-event-loop\AnalysisReport.sarif

特に問題なさそうだったので実際にアップグレードを実行します。
アップグレードは対話式で実行されます。
“Choose a command”では実行する内容を選択できます。基本的には1を入力しエンターキーを押下、もしくは単純にエンターキーを押下(デフォルトで一番上の選択肢が実行される)します。
“Please press enter to continue…”の場合はエンターキーを押下してください。
私は全部1を入力し問題なく実行できました。以下のログでは☆の箇所で入力しています。
ちょっと長いです。

> upgrade-assistant upgrade sinoalice-event-loop.sln
-----------------------------------------------------------------------------------------------------------------
Microsoft .NET Upgrade Assistant v0.4.410601+6304b1d0784e32e20ef0299db22bc9e3f6a9b3f3

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

[19:17:16 INF] Loaded 9 extensions
[19:17:18 INF] Using MSBuild from C:\Program Files\dotnet\sdk\7.0.200\
[19:17:18 INF] Using Visual Studio install from C:\Program Files\Microsoft Visual Studio\2022\Community [v17]
[19:17:21 INF] Initializing upgrade step Select an entrypoint
[19:17:21 INF] Setting entrypoint to only project in solution: C:\gomibako\net-upgrade\sinoalice-event-loop\sinoalice-event-loop\sinoalice-event-loop.csproj
[19:17:21 INF] Recommending Windows TFM net7.0-windows for project sinoalice-event-loop.csproj because the project either has Windows-specific dependencies or builds to a WinExe
[19:17:21 INF] Initializing upgrade step Select project to upgrade
[19:17:21 INF] Recommending Windows TFM net7.0-windows for project sinoalice-event-loop.csproj because the project either has Windows-specific dependencies or builds to a WinExe
[19:17:21 INF] Recommending Windows TFM net7.0-windows for project sinoalice-event-loop.csproj because the project either has Windows-specific dependencies or builds to a WinExe
[19:17:21 INF] Project sinoalice-event-loop was selected
[19:17:21 INF] Initializing upgrade step Back up project

Upgrade Steps

Entrypoint: C:\gomibako\net-upgrade\sinoalice-event-loop\sinoalice-event-loop\sinoalice-event-loop.csproj
Current Project: C:\gomibako\net-upgrade\sinoalice-event-loop\sinoalice-event-loop\sinoalice-event-loop.csproj

1. [Next step] Back up project
2. Convert project file to SDK style
3. Clean up NuGet package references
    a. Duplicate reference analyzer
    b. Package map reference analyzer
    c. Target compatibility reference analyzer
    d. Upgrade assistant reference analyzer
    e. Windows Compatibility Pack Analyzer
    f. MyDotAnalyzer reference analyzer
    g. Newtonsoft.Json reference analyzer
    h. Windows App SDK package analysis
    i. Transitive reference analyzer
4. Update TFM
5. Update NuGet Packages
    a. Duplicate reference analyzer
    b. Package map reference analyzer
    c. Target compatibility reference analyzer
    d. Upgrade assistant reference analyzer
    e. Windows Compatibility Pack Analyzer
    f. MyDotAnalyzer reference analyzer
    g. Newtonsoft.Json reference analyzer
    h. Windows App SDK package analysis
    i. Transitive reference analyzer
6. Add template files
7. Update WCF service to CoreWCF (Preview)
8. Update source code
    a. Apply fix for UA0002: Types should be upgraded
    b. Apply fix for UA0012: 'UnsafeDeserialize()' does not exist
9. 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. Configure logging
   5. Exit
> 1       ☆
[19:19:07 INF] Applying upgrade step Back up project
Please choose a backup path
   1. Use default path [C:\gomibako\net-upgrade\sinoalice-event-loop.backup]
   2. Enter custom path
> 1       ☆
[19:19:14 INF] Backing up C:\gomibako\net-upgrade\sinoalice-event-loop\sinoalice-event-loop to C:\gomibako\net-upgrade\sinoalice-event-loop.backup\sinoalice-event-loop
[19:19:14 INF] Project backed up to C:\gomibako\net-upgrade\sinoalice-event-loop.backup\sinoalice-event-loop
[19:19:14 INF] Upgrade step Back up project applied successfully
Please press enter to continue...       ☆エンターキー押す

[19:19:50 INF] Initializing upgrade step Convert project file to SDK style
[19:19:50 INF] Initializing upgrade step Clean up NuGet package references
[19:19:50 INF] Initializing upgrade step Duplicate reference analyzer
[19:19:50 INF] No package updates needed
[19:19:50 INF] Initializing upgrade step Package map reference analyzer
[19:19:50 INF] No package updates needed
[19:19:50 INF] Initializing upgrade step Target compatibility reference analyzer
[19:19:50 INF] No package updates needed
[19:19:50 INF] Initializing upgrade step Upgrade assistant reference analyzer
[19:19:50 INF] Reference to .NET Upgrade Assistant analyzer package (Microsoft.DotNet.UpgradeAssistant.Extensions.Default.Analyzers, version 0.4.410601) needs to be added
[19:19:50 INF] Initializing upgrade step Add package 'Microsoft.DotNet.UpgradeAssistant.Extensions.Default.Analyzers'

Upgrade Steps

Entrypoint: C:\gomibako\net-upgrade\sinoalice-event-loop\sinoalice-event-loop\sinoalice-event-loop.csproj
Current Project: C:\gomibako\net-upgrade\sinoalice-event-loop\sinoalice-event-loop\sinoalice-event-loop.csproj

1. [Complete] Back up project
2. [Complete] Convert project file to SDK style
3. Clean up NuGet package references
    a. [Complete] Duplicate reference analyzer
    b. [Complete] Package map reference analyzer
    c. [Complete] Target compatibility reference analyzer
    d. Upgrade assistant reference analyzer
        1. [Next step] Add package 'Microsoft.DotNet.UpgradeAssistant.Extensions.Default.Analyzers'
    e. Windows Compatibility Pack Analyzer
    f. MyDotAnalyzer reference analyzer
    g. Newtonsoft.Json reference analyzer
    h. Windows App SDK package analysis
    i. Transitive reference analyzer
4. Update TFM
5. Update NuGet Packages
    a. Duplicate reference analyzer
    b. Package map reference analyzer
    c. Target compatibility reference analyzer
    d. Upgrade assistant reference analyzer
    e. Windows Compatibility Pack Analyzer
    f. MyDotAnalyzer reference analyzer
    g. Newtonsoft.Json reference analyzer
    h. Windows App SDK package analysis
    i. Transitive reference analyzer
6. Add template files
7. Update WCF service to CoreWCF (Preview)
8. Update source code
    a. Apply fix for UA0002: Types should be upgraded
    b. Apply fix for UA0012: 'UnsafeDeserialize()' does not exist
9. Move to next project

Choose a command:
   1. Apply next step (Add package 'Microsoft.DotNet.UpgradeAssistant.Extensions.Default.Analyzers')
   2. Skip next step (Add package 'Microsoft.DotNet.UpgradeAssistant.Extensions.Default.Analyzers')
   3. See more step details
   4. Configure logging
   5. Exit
> 1       ☆
[19:20:31 INF] Applying upgrade step Add package 'Microsoft.DotNet.UpgradeAssistant.Extensions.Default.Analyzers'
[19:20:31 INF] Adding package reference: Microsoft.DotNet.UpgradeAssistant.Extensions.Default.Analyzers, Version=0.4.410601
[19:20:31 INF] Upgrade step Add package 'Microsoft.DotNet.UpgradeAssistant.Extensions.Default.Analyzers' applied successfully
[19:20:31 INF] Applying upgrade step Upgrade assistant reference analyzer
[19:20:31 INF] Upgrade step Upgrade assistant reference analyzer applied successfully
Please press enter to continue...       ☆エンターキー押す

[19:20:40 INF] Initializing upgrade step Windows Compatibility Pack Analyzer
[19:20:40 INF] No package updates needed
[19:20:40 INF] Initializing upgrade step MyDotAnalyzer reference analyzer
[19:20:40 INF] No package updates needed
[19:20:40 INF] Initializing upgrade step Newtonsoft.Json reference analyzer
[19:20:40 INF] No package updates needed
[19:20:40 INF] Initializing upgrade step Windows App SDK package analysis
[19:20:40 INF] No package updates needed
[19:20:40 INF] Initializing upgrade step Transitive reference analyzer
[19:20:40 INF] Initializing upgrade step Remove package 'OpenCvSharp4'

Upgrade Steps

Entrypoint: C:\gomibako\net-upgrade\sinoalice-event-loop\sinoalice-event-loop\sinoalice-event-loop.csproj
Current Project: C:\gomibako\net-upgrade\sinoalice-event-loop\sinoalice-event-loop\sinoalice-event-loop.csproj

1. [Complete] Back up project
2. [Complete] Convert project file to SDK style
3. Clean up NuGet package references
    a. [Complete] Duplicate reference analyzer
    b. [Complete] Package map reference analyzer
    c. [Complete] Target compatibility reference analyzer
    d. [Complete] Upgrade assistant reference analyzer
        1. [Complete] Add package 'Microsoft.DotNet.UpgradeAssistant.Extensions.Default.Analyzers'
    e. [Complete] Windows Compatibility Pack Analyzer
    f. [Complete] MyDotAnalyzer reference analyzer
    g. [Complete] Newtonsoft.Json reference analyzer
    h. [Complete] Windows App SDK package analysis
    i. Transitive reference analyzer
        1. [Next step] Remove package 'OpenCvSharp4'
        2. Remove package 'OpenCvSharp4.runtime.win'
        3. Remove package 'OpenCvSharp4.WpfExtensions'
        4. Remove package 'System.Drawing.Common'
4. Update TFM
5. Update NuGet Packages
    a. Duplicate reference analyzer
    b. Package map reference analyzer
    c. Target compatibility reference analyzer
    d. Upgrade assistant reference analyzer
    e. Windows Compatibility Pack Analyzer
    f. MyDotAnalyzer reference analyzer
    g. Newtonsoft.Json reference analyzer
    h. Windows App SDK package analysis
    i. Transitive reference analyzer
6. Add template files
7. Update WCF service to CoreWCF (Preview)
8. Update source code
    a. Apply fix for UA0002: Types should be upgraded
    b. Apply fix for UA0012: 'UnsafeDeserialize()' does not exist
9. Move to next project

Choose a command:
   1. Apply next step (Remove package 'OpenCvSharp4')
   2. Skip next step (Remove package 'OpenCvSharp4')
   3. See more step details
   4. Configure logging
   5. Exit
> 1       ☆
[19:22:28 INF] Applying upgrade step Remove package 'OpenCvSharp4'
[19:22:28 INF] Removing outdated package reference: OpenCvSharp4, Version=4.5.3.20210725
[19:22:28 INF] Upgrade step Remove package 'OpenCvSharp4' applied successfully
Please press enter to continue...       ☆エンターキー押す

[19:22:30 INF] Initializing upgrade step Remove package 'OpenCvSharp4.runtime.win'

Upgrade Steps

Entrypoint: C:\gomibako\net-upgrade\sinoalice-event-loop\sinoalice-event-loop\sinoalice-event-loop.csproj
Current Project: C:\gomibako\net-upgrade\sinoalice-event-loop\sinoalice-event-loop\sinoalice-event-loop.csproj

1. [Complete] Back up project
2. [Complete] Convert project file to SDK style
3. Clean up NuGet package references
    a. [Complete] Duplicate reference analyzer
    b. [Complete] Package map reference analyzer
    c. [Complete] Target compatibility reference analyzer
    d. [Complete] Upgrade assistant reference analyzer
        1. [Complete] Add package 'Microsoft.DotNet.UpgradeAssistant.Extensions.Default.Analyzers'
    e. [Complete] Windows Compatibility Pack Analyzer
    f. [Complete] MyDotAnalyzer reference analyzer
    g. [Complete] Newtonsoft.Json reference analyzer
    h. [Complete] Windows App SDK package analysis
    i. Transitive reference analyzer
        1. [Complete] Remove package 'OpenCvSharp4'
        2. [Next step] Remove package 'OpenCvSharp4.runtime.win'
        3. Remove package 'OpenCvSharp4.WpfExtensions'
        4. Remove package 'System.Drawing.Common'
4. Update TFM
5. Update NuGet Packages
    a. Duplicate reference analyzer
    b. Package map reference analyzer
    c. Target compatibility reference analyzer
    d. Upgrade assistant reference analyzer
    e. Windows Compatibility Pack Analyzer
    f. MyDotAnalyzer reference analyzer
    g. Newtonsoft.Json reference analyzer
    h. Windows App SDK package analysis
    i. Transitive reference analyzer
6. Add template files
7. Update WCF service to CoreWCF (Preview)
8. Update source code
    a. Apply fix for UA0002: Types should be upgraded
    b. Apply fix for UA0012: 'UnsafeDeserialize()' does not exist
9. Move to next project

Choose a command:
   1. Apply next step (Remove package 'OpenCvSharp4.runtime.win')
   2. Skip next step (Remove package 'OpenCvSharp4.runtime.win')
   3. See more step details
   4. Configure logging
   5. Exit
> 1       ☆
[19:22:33 INF] Applying upgrade step Remove package 'OpenCvSharp4.runtime.win'
[19:22:33 INF] Removing outdated package reference: OpenCvSharp4.runtime.win, Version=4.5.3.20210725
[19:22:33 INF] Upgrade step Remove package 'OpenCvSharp4.runtime.win' applied successfully
Please press enter to continue...       ☆エンターキー押す

[19:22:36 INF] Initializing upgrade step Remove package 'OpenCvSharp4.WpfExtensions'

Upgrade Steps

Entrypoint: C:\gomibako\net-upgrade\sinoalice-event-loop\sinoalice-event-loop\sinoalice-event-loop.csproj
Current Project: C:\gomibako\net-upgrade\sinoalice-event-loop\sinoalice-event-loop\sinoalice-event-loop.csproj

1. [Complete] Back up project
2. [Complete] Convert project file to SDK style
3. Clean up NuGet package references
    a. [Complete] Duplicate reference analyzer
    b. [Complete] Package map reference analyzer
    c. [Complete] Target compatibility reference analyzer
    d. [Complete] Upgrade assistant reference analyzer
        1. [Complete] Add package 'Microsoft.DotNet.UpgradeAssistant.Extensions.Default.Analyzers'
    e. [Complete] Windows Compatibility Pack Analyzer
    f. [Complete] MyDotAnalyzer reference analyzer
    g. [Complete] Newtonsoft.Json reference analyzer
    h. [Complete] Windows App SDK package analysis
    i. Transitive reference analyzer
        1. [Complete] Remove package 'OpenCvSharp4'
        2. [Complete] Remove package 'OpenCvSharp4.runtime.win'
        3. [Next step] Remove package 'OpenCvSharp4.WpfExtensions'
        4. Remove package 'System.Drawing.Common'
4. Update TFM
5. Update NuGet Packages
    a. Duplicate reference analyzer
    b. Package map reference analyzer
    c. Target compatibility reference analyzer
    d. Upgrade assistant reference analyzer
    e. Windows Compatibility Pack Analyzer
    f. MyDotAnalyzer reference analyzer
    g. Newtonsoft.Json reference analyzer
    h. Windows App SDK package analysis
    i. Transitive reference analyzer
6. Add template files
7. Update WCF service to CoreWCF (Preview)
8. Update source code
    a. Apply fix for UA0002: Types should be upgraded
    b. Apply fix for UA0012: 'UnsafeDeserialize()' does not exist
9. Move to next project

Choose a command:
   1. Apply next step (Remove package 'OpenCvSharp4.WpfExtensions')
   2. Skip next step (Remove package 'OpenCvSharp4.WpfExtensions')
   3. See more step details
   4. Configure logging
   5. Exit
> 1       ☆
[19:22:39 INF] Applying upgrade step Remove package 'OpenCvSharp4.WpfExtensions'
[19:22:39 INF] Removing outdated package reference: OpenCvSharp4.WpfExtensions, Version=4.5.3.20210725
[19:22:39 INF] Upgrade step Remove package 'OpenCvSharp4.WpfExtensions' applied successfully
Please press enter to continue...       ☆エンターキー押す

[19:22:40 INF] Initializing upgrade step Remove package 'System.Drawing.Common'

Upgrade Steps

Entrypoint: C:\gomibako\net-upgrade\sinoalice-event-loop\sinoalice-event-loop\sinoalice-event-loop.csproj
Current Project: C:\gomibako\net-upgrade\sinoalice-event-loop\sinoalice-event-loop\sinoalice-event-loop.csproj

1. [Complete] Back up project
2. [Complete] Convert project file to SDK style
3. Clean up NuGet package references
    a. [Complete] Duplicate reference analyzer
    b. [Complete] Package map reference analyzer
    c. [Complete] Target compatibility reference analyzer
    d. [Complete] Upgrade assistant reference analyzer
        1. [Complete] Add package 'Microsoft.DotNet.UpgradeAssistant.Extensions.Default.Analyzers'
    e. [Complete] Windows Compatibility Pack Analyzer
    f. [Complete] MyDotAnalyzer reference analyzer
    g. [Complete] Newtonsoft.Json reference analyzer
    h. [Complete] Windows App SDK package analysis
    i. Transitive reference analyzer
        1. [Complete] Remove package 'OpenCvSharp4'
        2. [Complete] Remove package 'OpenCvSharp4.runtime.win'
        3. [Complete] Remove package 'OpenCvSharp4.WpfExtensions'
        4. [Next step] Remove package 'System.Drawing.Common'
4. Update TFM
5. Update NuGet Packages
    a. Duplicate reference analyzer
    b. Package map reference analyzer
    c. Target compatibility reference analyzer
    d. Upgrade assistant reference analyzer
    e. Windows Compatibility Pack Analyzer
    f. MyDotAnalyzer reference analyzer
    g. Newtonsoft.Json reference analyzer
    h. Windows App SDK package analysis
    i. Transitive reference analyzer
6. Add template files
7. Update WCF service to CoreWCF (Preview)
8. Update source code
    a. Apply fix for UA0002: Types should be upgraded
    b. Apply fix for UA0012: 'UnsafeDeserialize()' does not exist
9. Move to next project

Choose a command:
   1. Apply next step (Remove package 'System.Drawing.Common')
   2. Skip next step (Remove package 'System.Drawing.Common')
   3. See more step details
   4. Configure logging
   5. Exit
> 1       ☆
[19:22:42 INF] Applying upgrade step Remove package 'System.Drawing.Common'
[19:22:42 INF] Removing outdated package reference: System.Drawing.Common, Version=5.0.2
[19:22:42 INF] Upgrade step Remove package 'System.Drawing.Common' applied successfully
[19:22:42 INF] Applying upgrade step Transitive reference analyzer
[19:22:42 INF] Upgrade step Transitive reference analyzer applied successfully
[19:22:42 INF] Applying upgrade step Clean up NuGet package references
[19:22:42 INF] Upgrade step Clean up NuGet package references applied successfully
Please press enter to continue...       ☆エンターキー押す

[19:22:46 INF] Initializing upgrade step Update TFM
[19:22:46 INF] Recommending Windows TFM net7.0-windows for project sinoalice-event-loop.csproj because the project either has Windows-specific dependencies or builds to a WinExe
[19:22:46 INF] TFM needs updated to net7.0-windows

Upgrade Steps

Entrypoint: C:\gomibako\net-upgrade\sinoalice-event-loop\sinoalice-event-loop\sinoalice-event-loop.csproj
Current Project: C:\gomibako\net-upgrade\sinoalice-event-loop\sinoalice-event-loop\sinoalice-event-loop.csproj

1. [Complete] Back up project
2. [Complete] Convert project file to SDK style
3. [Complete] Clean up NuGet package references
    a. [Complete] Duplicate reference analyzer
    b. [Complete] Package map reference analyzer
    c. [Complete] Target compatibility reference analyzer
    d. [Complete] Upgrade assistant reference analyzer
        1. [Complete] Add package 'Microsoft.DotNet.UpgradeAssistant.Extensions.Default.Analyzers'
    e. [Complete] Windows Compatibility Pack Analyzer
    f. [Complete] MyDotAnalyzer reference analyzer
    g. [Complete] Newtonsoft.Json reference analyzer
    h. [Complete] Windows App SDK package analysis
    i. [Complete] Transitive reference analyzer
        1. [Complete] Remove package 'OpenCvSharp4'
        2. [Complete] Remove package 'OpenCvSharp4.runtime.win'
        3. [Complete] Remove package 'OpenCvSharp4.WpfExtensions'
        4. [Complete] Remove package 'System.Drawing.Common'
4. [Next step] Update TFM
5. Update NuGet Packages
    a. Duplicate reference analyzer
    b. Package map reference analyzer
    c. Target compatibility reference analyzer
    d. Upgrade assistant reference analyzer
    e. Windows Compatibility Pack Analyzer
    f. MyDotAnalyzer reference analyzer
    g. Newtonsoft.Json reference analyzer
    h. Windows App SDK package analysis
    i. Transitive reference analyzer
6. Add template files
7. Update WCF service to CoreWCF (Preview)
8. Update source code
    a. Apply fix for UA0002: Types should be upgraded
    b. Apply fix for UA0012: 'UnsafeDeserialize()' does not exist
9. 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. Configure logging
   5. Exit
> 1       ☆
[19:22:50 INF] Applying upgrade step Update TFM
[19:22:50 INF] Recommending Windows TFM net7.0-windows for project sinoalice-event-loop.csproj because the project either has Windows-specific dependencies or builds to a WinExe
[19:22:54 INF] Updated TFM to net7.0-windows
[19:22:54 INF] Upgrade step Update TFM applied successfully
Please press enter to continue...       ☆エンターキー押す

[19:22:56 INF] Initializing upgrade step Update NuGet Packages
[19:22:56 INF] Initializing upgrade step Duplicate reference analyzer
[19:22:56 INF] No package updates needed
[19:22:56 INF] Initializing upgrade step Package map reference analyzer
[19:22:56 INF] No package updates needed
[19:22:56 INF] Initializing upgrade step Target compatibility reference analyzer
[19:22:56 INF] No package updates needed
[19:22:56 INF] Initializing upgrade step Upgrade assistant reference analyzer
[19:22:56 INF] No package updates needed
[19:22:56 INF] Initializing upgrade step Windows Compatibility Pack Analyzer
[19:22:58 INF] Adding Microsoft.Windows.Compatibility 7.0.0 helps with speeding up the upgrade process for Windows-based APIs
[19:22:58 INF] Initializing upgrade step Add package 'Microsoft.Windows.Compatibility'

Upgrade Steps

Entrypoint: C:\gomibako\net-upgrade\sinoalice-event-loop\sinoalice-event-loop\sinoalice-event-loop.csproj
Current Project: C:\gomibako\net-upgrade\sinoalice-event-loop\sinoalice-event-loop\sinoalice-event-loop.csproj

1. [Complete] Back up project
2. [Complete] Convert project file to SDK style
3. [Complete] Clean up NuGet package references
    a. [Complete] Duplicate reference analyzer
    b. [Complete] Package map reference analyzer
    c. [Complete] Target compatibility reference analyzer
    d. [Complete] Upgrade assistant reference analyzer
        1. [Complete] Add package 'Microsoft.DotNet.UpgradeAssistant.Extensions.Default.Analyzers'
    e. [Complete] Windows Compatibility Pack Analyzer
    f. [Complete] MyDotAnalyzer reference analyzer
    g. [Complete] Newtonsoft.Json reference analyzer
    h. [Complete] Windows App SDK package analysis
    i. [Complete] Transitive reference analyzer
        1. [Complete] Remove package 'OpenCvSharp4'
        2. [Complete] Remove package 'OpenCvSharp4.runtime.win'
        3. [Complete] Remove package 'OpenCvSharp4.WpfExtensions'
        4. [Complete] Remove package 'System.Drawing.Common'
4. [Complete] Update TFM
5. Update NuGet Packages
    a. [Complete] Duplicate reference analyzer
    b. [Complete] Package map reference analyzer
    c. [Complete] Target compatibility reference analyzer
    d. [Complete] Upgrade assistant reference analyzer
    e. Windows Compatibility Pack Analyzer
        1. [Next step] Add package 'Microsoft.Windows.Compatibility'
    f. MyDotAnalyzer reference analyzer
    g. Newtonsoft.Json reference analyzer
    h. Windows App SDK package analysis
    i. Transitive reference analyzer
6. Add template files
7. Update WCF service to CoreWCF (Preview)
8. Update source code
    a. Apply fix for UA0002: Types should be upgraded
    b. Apply fix for UA0012: 'UnsafeDeserialize()' does not exist
9. Move to next project

Choose a command:
   1. Apply next step (Add package 'Microsoft.Windows.Compatibility')
   2. Skip next step (Add package 'Microsoft.Windows.Compatibility')
   3. See more step details
   4. Configure logging
   5. Exit
> 1       ☆
[19:23:04 INF] Applying upgrade step Add package 'Microsoft.Windows.Compatibility'
[19:23:04 INF] Adding package reference: Microsoft.Windows.Compatibility, Version=7.0.0
[19:23:04 INF] Upgrade step Add package 'Microsoft.Windows.Compatibility' applied successfully
[19:23:04 INF] Applying upgrade step Windows Compatibility Pack Analyzer
[19:23:04 INF] Upgrade step Windows Compatibility Pack Analyzer applied successfully
Please press enter to continue...       ☆エンターキー押す

[19:23:06 INF] Initializing upgrade step MyDotAnalyzer reference analyzer
[19:23:06 INF] No package updates needed
[19:23:06 INF] Initializing upgrade step Newtonsoft.Json reference analyzer
[19:23:06 INF] No package updates needed
[19:23:06 INF] Initializing upgrade step Windows App SDK package analysis
[19:23:06 INF] No package updates needed
[19:23:06 INF] Initializing upgrade step Transitive reference analyzer
[19:23:06 INF] No package updates needed
[19:23:06 INF] Applying upgrade step Update NuGet Packages
[19:23:06 INF] Upgrade step Update NuGet Packages applied successfully
[19:23:06 INF] Initializing upgrade step Add template files
[19:23:06 INF] 0 expected template items needed
[19:23:06 INF] Initializing upgrade step Update WCF service to CoreWCF (Preview)
[19:23:06 WRN] Can not find .cs file with Main() method. The project is not applicable for automated WCF update. No more work needs to be done and this step is complete.
[19:23:06 INF] Initializing upgrade step Update source code
[19:23:06 INF] Running analyzers on sinoalice-event-loop
[19:23:09 INF] Identified 0 diagnostics in project sinoalice-event-loop
[19:23:09 INF] Initializing upgrade step Move to next project

Upgrade Steps

Entrypoint: C:\gomibako\net-upgrade\sinoalice-event-loop\sinoalice-event-loop\sinoalice-event-loop.csproj
Current Project: C:\gomibako\net-upgrade\sinoalice-event-loop\sinoalice-event-loop\sinoalice-event-loop.csproj

1. [Complete] Back up project
2. [Complete] Convert project file to SDK style
3. [Complete] Clean up NuGet package references
    a. [Complete] Duplicate reference analyzer
    b. [Complete] Package map reference analyzer
    c. [Complete] Target compatibility reference analyzer
    d. [Complete] Upgrade assistant reference analyzer
        1. [Complete] Add package 'Microsoft.DotNet.UpgradeAssistant.Extensions.Default.Analyzers'
    e. [Complete] Windows Compatibility Pack Analyzer
    f. [Complete] MyDotAnalyzer reference analyzer
    g. [Complete] Newtonsoft.Json reference analyzer
    h. [Complete] Windows App SDK package analysis
    i. [Complete] Transitive reference analyzer
        1. [Complete] Remove package 'OpenCvSharp4'
        2. [Complete] Remove package 'OpenCvSharp4.runtime.win'
        3. [Complete] Remove package 'OpenCvSharp4.WpfExtensions'
        4. [Complete] Remove package 'System.Drawing.Common'
4. [Complete] Update TFM
5. [Complete] Update NuGet Packages
    a. [Complete] Duplicate reference analyzer
    b. [Complete] Package map reference analyzer
    c. [Complete] Target compatibility reference analyzer
    d. [Complete] Upgrade assistant reference analyzer
    e. [Complete] Windows Compatibility Pack Analyzer
        1. [Complete] Add package 'Microsoft.Windows.Compatibility'
    f. [Complete] MyDotAnalyzer reference analyzer
    g. [Complete] Newtonsoft.Json reference analyzer
    h. [Complete] Windows App SDK package analysis
    i. [Complete] Transitive reference analyzer
6. [Complete] Add template files
7. [Complete] Update WCF service to CoreWCF (Preview)
8. [Complete] Update source code
    a. [Complete] Apply fix for UA0002: Types should be upgraded
    b. [Complete] Apply fix for UA0012: 'UnsafeDeserialize()' does not exist
9. [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. Configure logging
   5. Exit
> 1       ☆
[19:23:21 INF] Applying upgrade step Move to next project
[19:23:21 INF] Upgrade step Move to next project applied successfully
Please press enter to continue...       ☆エンターキー押す

[19:23:23 INF] Recommending Windows TFM net7.0-windows for project sinoalice-event-loop.csproj because the project either has Windows-specific dependencies or builds to a WinExe
[19:23:23 INF] Recommending Windows TFM net7.0-windows for project sinoalice-event-loop.csproj because the project either has Windows-specific dependencies or builds to a WinExe
[19:23:23 INF] Recommending Windows TFM net7.0-windows for project sinoalice-event-loop.csproj because the project either has Windows-specific dependencies or builds to a WinExe
[19:23:23 INF] Initializing upgrade step Finalize upgrade

Upgrade Steps

Entrypoint: C:\gomibako\net-upgrade\sinoalice-event-loop\sinoalice-event-loop\sinoalice-event-loop.csproj

[19:23:23 INF] Recommending Windows TFM net7.0-windows for project sinoalice-event-loop.csproj 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       ☆
[19:23:26 INF] Applying upgrade step Finalize upgrade
[19:23:26 INF] Upgrade step Finalize upgrade applied successfully
Please press enter to continue...       ☆エンターキー押す

[19:23:28 INF] Upgrade has completed. Please review any changes.
[19:23:28 INF] The Upgrade Report is generated at C:\gomibako\net-upgrade\sinoalice-event-loop\UpgradeReport.sarif

以上でアップグレード完了です。

プロパティを確認すると.NET 6.0に変更され、ビルドエラーも出ていませんでした。

framework version

差分

変更されたのは .csproj です。画像ですが差分内容を載せておきます。
ちょっと気になるのはOpenCV系のライブラリが消えてるんですよね。
まだ動作確認はしていないのでどうなるかわかりませんが、この程度の修正なら全然問題ないので簡単に移行出来て良かったなと思った次第です。
動作確認めんどくさい・・・。

diff

参考

コメント

タイトルとURLをコピーしました