Tool-upgrade-assistant

[删除(380066935@qq.com或微信通知)]

https://github.com/dotnet/upgrade-assistant


Upgrade Assistant

Share your feedback on the .NET Upgrade Assistant!

We're interested to hearing how your experience with the .NET Upgrade Assistant has been going as you upgrade your project(s) from .NET Framework to the latest version of .NET (current, LTS, or preview).


This project enables automation of common tasks related to upgrading .NET Framework projects to the latest versions of .NET (current, LTS, or Preview). See https://dotnet.microsoft.com/platform/support/policy/dotnet-core for more details for what these mean.Note that this is not a complete upgrade tool and work will be required after using the tooling to upgrade a project.


Upgrade Solution

When run on a solution in order to upgrade, the tool will:


Determine which projects need upgraded and recommend the order the projects should be upgraded in

Update the project file to be an SDK-style project

Remove transitive NuGet package dependencies that may have been present in packages.config

Re-target project to .NET current, LTS, or preview

Update NuGet package dependencies to versions that are compatible with .NET current, LTS, or preview

Make simple updates in C# source code to replace patterns that worked in .NET Framework with current, LTS, or preview equivalents

For some app models (like ASP.NET apps), add common template files (like startup.cs) and make simple updates based on recognized web.config or app.config values

For projects targeting Windows, add a reference to the Microsoft.Windows.Compatibility package

Add references to analyzers that help with upgrade, such as the Microsoft.DotNet.UpgradeAssistant.Extensions.Default.Analyzers package

After running this tool on a solution to upgrade, the solution will likely not build until the upgrade is completed manually. Analyzers added to the solution will highlight some of the remaining changes needed after the tool runs.


Analyze Solution prior to Upgrade

When run on a solution in order to analyze dependencies prior to upgrade, the tool will provide an analysis report for each of the projects in the solution containing details on:


Package dependencies that need to be removed / added / upgraded in order to upgrade the project to chosen TFM (current, LTS, or preview)

References that need to be removed / added / upgraded in order to upgrade the project to chosen TFM (current, LTS, or preview)

Framework References that need to be removed / added / upgraded in order to upgrade the project to chosen TFM (current, LTS, or preview)

Call out if there is a package upgrade across major versions that could lead towards having breaking changes.

Unsupported API for the chosen TFM (current, LTS, or preview) used in the projects with pointers to recommended path forward if one is available.

Solution wide extension management

Extensions may be managed centrally for a project as described here.


Experimental features

Feature flags can be used to turn some experimental features on or off. Functionality behind feature flags may or may not be made public and are considered a way to test features that may be unstable. In order to enable a feature, set an environment variable to a semi-colon delimited list of feature names. For example: $env:UA_FEATURES="FEATURE1;FEATURE2".


Current features that are available to try out include:


ANALYZE_OUTPUT_FORMAT: Enables a --format flag for the analyze command that can take other options. Currently restricted to sarif and html

SOLUTION_WIDE_SDK_CONVERSION: Switches project format conversion from old style project files to SDK style to be solution wide first before any other changes to the project files.