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 for Converge360.

comments powered by Disqus

Featured

  • Full Stack Hands-On Development with .NET

    In the fast-paced realm of modern software development, proficiency across a full stack of technologies is not just beneficial, it's essential. Microsoft has an entire stack of open source development components in its .NET platform (formerly known as .NET Core) that can be used to build an end-to-end set of applications.

  • .NET-Centric Uno Platform Debuts 'Single Project' for 9 Targets

    "We've reduced the complexity of project files and eliminated the need for explicit NuGet package references, separate project libraries, or 'shared' projects."

  • Creating Reactive Applications in .NET

    In modern applications, data is being retrieved in asynchronous, real-time streams, as traditional pull requests where the clients asks for data from the server are becoming a thing of the past.

  • AI for GitHub Collaboration? Maybe Not So Much

    No doubt GitHub Copilot has been a boon for developers, but AI might not be the best tool for collaboration, according to developers weighing in on a recent social media post from the GitHub team.

  • Visual Studio 2022 Getting VS Code 'Command Palette' Equivalent

    As any Visual Studio Code user knows, the editor's command palette is a powerful tool for getting things done quickly, without having to navigate through menus and dialogs. Now, we learn how an equivalent is coming for Microsoft's flagship Visual Studio IDE, invoked by the same familiar Ctrl+Shift+P keyboard shortcut.

Subscribe on YouTube