News

As .NET Core 2.1 Support Nears End, Microsoft Previews .NET Upgrade Assistant

Microsoft recently warned developers that .NET Core 2.1 won't be supported after Aug. 21, after previewing a new .NET Upgrade Assistant.

The two moves made early this month aren't directly related, as the upgrade tool is intended to help developers modernize applications built with the old Windows-only .NET Framework in order to run on the cross-platform, open source .NET 5. However, they do highlight the progress of the .NET unification initiative and the need to keep current.

.NET Core 2.1 arrived on the scene back in May 2018, following up on v2.0's work to introduce tens of thousands of new APIs to the new framework. It was a long-term support (LTS) release, guaranteed to be supported for three years or for one year after the next LTS release is shipped, whichever is longer.

The .NET Schedule
[Click on image for larger view.] The .NET Schedule (source: Microsoft).

".NET Core 2.1 will be reaching end of support on August 21, 2021 and after this date we will no longer provide updates including security fixes, or technical support for this version. We strongly recommend you migrate your applications to .NET Core 3.1 or later before this date," Microsoft said in a March 4 blog post.

Coincidentally, the company only two days earlier introduced the preview of the new .NET Framework-to-.NET 5 upgrade assistant.

.NET Upgrade Assistant
[Click on image for larger view.] .NET Upgrade Assistant (source: Microsoft).

It's a .NET global command-line tool that provides guidance for incrementally upgrading applications. Although it has been around for more than a year, Microsoft just announced it as a preview. The heart of the tool is the GitHub-based, command-line try-convert project, which is bundled with extensive guidance in the assistant.

.NET 5
[Click on image for larger view.] .NET 5 (source: Microsoft).

Year-old documentation referenced above includes this description of the tool:

"The .NET Upgrade Assistant is a command-line tool that can be run on different kinds of .NET Framework apps. It's designed to assist with upgrading .NET Framework apps to .NET 5. After running the tool, in most cases the app will require more effort to complete the migration. The tool includes the installation of analyzers that can assist with completing the migration."

It supports the following .NET Framework app types:

  • .NET Framework Windows Forms apps
  • .NET Framework WPF apps
  • .NET Framework ASP.NET MVC apps
  • .NET Framework console apps
  • .NET Framework class libraries

In announcing the preview, Microsoft outlined its seven-step process:

  1. Backup your projects: Ensuring you have a backup (and your code is in source control), means you can easily rollback to a working state if you need to at any point.
  2. Update the projects to be SDK-style projects: .NET 5 uses a simplified and different project file format compared to .NET Framework. This step uses the try-convert tool that was installed as part of the pre-requisites to move all your projects over to the new SDK-style project format.
  3. Update the target framework (Update TFM): At this step, the tool will re-target your projects to target .NET 5.0. Read more about target frameworks.
  4. Update NuGet packages in your projects: Here, NuGet package dependencies are updated to versions that are compatible with .NET 5.0.
  5. Add template files: For some application models like ASP.NET apps, common template files (like Program.cs and Startup.cs) are missing in older framework app versions, so they are added at this step and simple updates are also made based on recognized web.config or app.config values.
  6. Update C# source: Now that all your projects have been upgraded to .NET 5 and references upgraded when the tool could help, it's time to make some specific fixes to the C# code.
  7. Move to next project: If your solution includes multiple projects, this is where you'd move on to working on the next project that was recommended in the beginning.

The open source project's GitHub site provides another take on those steps, illustrated here:

 .NET Upgrade Assistant GitHub Description
[Click on image for larger view.] .NET Upgrade Assistant GitHub Description (source: Microsoft).

Other migration tools exist, of course, even from third-party vendors like AWS, which open sourced a tool for porting .NET Framework apps to .NET Core on its cloud platform. Another firm automates Visual Basic upgrades.

There is even more guidance available for .NET Framework upgrades, including:

All that guidance is needed because Microsoft has, as is did above, repeatedly warned that there's no magic do-everything functionality to be had -- much dev work may well be required for most projects, certainly big, complex ones.

"Remember, that the tool is not intended to completely upgrade .NET Framework applications to .NET 5. Manual changes will still need to be made because these require knowledge of the app and how it's intended to function," last week's post advised.

"We recommend that once you're finished in the tool, you head back to Visual Studio and attempt to build your code. Look for warnings in the Error List window of Visual Studio to help you identify other parts of your code that might not be supported in .NET 5. You should also check any NuGet packages that might have been updated as sometimes there are breaking changes and you may need to revert to an older version."

About the Author

David Ramel is an editor and writer at Converge 360.

comments powered by Disqus

Featured

  • Compare New GitHub Copilot Free Plan for Visual Studio/VS Code to Paid Plans

    The free plan restricts the number of completions, chat requests and access to AI models, being suitable for occasional users and small projects.

  • Diving Deep into .NET MAUI

    Ever since someone figured out that fiddling bits results in source code, developers have sought one codebase for all types of apps on all platforms, with Microsoft's latest attempt to further that effort being .NET MAUI.

  • Copilot AI Boosts Abound in New VS Code v1.96

    Microsoft improved on its new "Copilot Edit" functionality in the latest release of Visual Studio Code, v1.96, its open-source based code editor that has become the most popular in the world according to many surveys.

  • AdaBoost Regression Using C#

    Dr. James McCaffrey from Microsoft Research presents a complete end-to-end demonstration of the AdaBoost.R2 algorithm for regression problems (where the goal is to predict a single numeric value). The implementation follows the original source research paper closely, so you can use it as a guide for customization for specific scenarios.

  • Versioning and Documenting ASP.NET Core Services

    Building an API with ASP.NET Core is only half the job. If your API is going to live more than one release cycle, you're going to need to version it. If you have other people building clients for it, you're going to need to document it.

Subscribe on YouTube