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

  • Hands On: New VS Code Insiders Build Creates Web Page from Image in Seconds

    New Vision support with GitHub Copilot in the latest Visual Studio Code Insiders build takes a user-supplied mockup image and creates a web page from it in seconds, handling all the HTML and CSS.

  • Naive Bayes Regression Using C#

    Dr. James McCaffrey from Microsoft Research presents a complete end-to-end demonstration of the naive Bayes regression technique, where the goal is to predict a single numeric value. Compared to other machine learning regression techniques, naive Bayes regression is usually less accurate, but is simple, easy to implement and customize, works on both large and small datasets, is highly interpretable, and doesn't require tuning any hyperparameters.

  • VS Code Copilot Previews New GPT-4o AI Code Completion Model

    The 4o upgrade includes additional training on more than 275,000 high-quality public repositories in over 30 popular programming languages, said Microsoft-owned GitHub, which created the original "AI pair programmer" years ago.

  • Microsoft's Rust Embrace Continues with Azure SDK Beta

    "Rust's strong type system and ownership model help prevent common programming errors such as null pointer dereferencing and buffer overflows, leading to more secure and stable code."

  • Xcode IDE from Microsoft Archrival Apple Gets Copilot AI

    Just after expanding the reach of its Copilot AI coding assistant to the open-source Eclipse IDE, Microsoft showcased how it's going even further, providing details about a preview version for the Xcode IDE from archrival Apple.

Subscribe on YouTube

Upcoming Training Events