Amazon Web Services is trying to lure more to developers to its cloud by creating a tool built for porting .NET applications to Linux, though in its current form we found it to be less useful than hoped.
The Porting Assistant for .NET is to help users convert a Windows-only .NET Framework application (which typically runs on the IIS web server) to a .NET Core application that will run on Linux and, Amazon hopes, be easy to migrate to the AWS cloud.
Six years ago Microsoft forked the .NET platform, leaving .NET Framework as Windows-only and creating the open-source .NET Core, cross-platform on Windows, Linux and Mac. It was inevitable that the .NET Framework version would be left behind, and Microsoft said last year that ".NET Framework 4.8 will be the last major version."
The tool will give you good or bad news about the compatibility of NuGet packages in a project, and recommend upgrades (even sometimes alpha versions). Click to enlarge
Running on .NET Core generally means better performance as well as deployment flexibility and no need to license Windows Server to run an application.
Porting from .NET Framework, though, can be a challenge, especially since ASP.NET Web Forms, a popular framework for web applications, has not been implemented in .NET Core. Businesses with .NET Framework web applications can migrate them to Windows Server on public cloud, but migrating them to .NET Core is a better solution if it can be done without too much pain and risk.
AWS is keen for its customers to make this move, no doubt in the hope that more applications will find their way onto its cloud platform, and to that end has released the Porting Assistant for .NET, which promises to assist. Microsoft also has some porting tools, including try-convert which "can convert a project or entire solution to the .NET SDK," but it comes with a bunch of warnings including that it "rejects many project types that are incompatible with .NET Core."
Our first thought seeing the AWS Porting Assistant was why Microsoft had not come up with it first.
Unfortunately, the tool is currently rather limited. We downloaded the Porting Assistant and went though the installation process, which requires an AWS profile as also used by the AWS Command Line Interface. The reason for this login requirement is that the tool needs access to data stored in S3, this being a database of "compatibility information for all the NuGet packages available in nuget.org – 211k unique packages, 2.5 millions packaged versions," according to the GitHub repository, though note that this repository does not have the data, nor the code to the application, but only the location of the data. Yes, it is a small repository.
Once installed and configured, you can select a .NET solution file and the tool gets to work – provided you can find a suitable target application. Supported projects are "C# ASP.NET applications deployed in IIS running on Windows Server 2016 and later." The version of the .NET Framework must be 3.5 or later.
You point the tool at the Visual Studio solution file and it will analyse the NuGet packages, marking them compatible or incompatible, and where possible showing suggested replacements. It will also list incompatible .NET API calls. The tool only targets .NET Core on Linux; despite the cross-platform nature of the platform, AWS seems opinionated on this being a better destination than Windows.
There is an optimistic button labelled "Port project", which will let you choose a target .NET version and create a new project for you. It is unlikely to be much help. AWS warned: "When you port a solution, your code is not refactored. Your packages are upgraded to their latest compatible version and relevant project reference files are updated to the format compatible with .NET Core. Additional source code changes may be required. If there are additional unresolved incompatibilities that require code changes, the project might not build after porting."
In other words, there is no magic here, and we would also suggest that automatically moving to the "latest compatible version" of every package is not always a good idea, especially since the tool seems happy to recommend upgrades that are labelled alpha.
The best thing about the Porting Assistant is the pretty graph you get when you click Project References, which shows each project in the solution with a graphical representation of its dependencies. Is it any more useful than inspecting the project in Visual Studio? Not really, but it is a nice visualisation.
It is smart of AWS to highlight the value of porting projects from .NET Framework to .NET Core, and fits with its strategy of presenting its platform as a good home for Windows platform applications.
Another recent move is the AWS App2Container for containerising .NET and Java applications; this actually works with .NET Framework ASP.NET Application deployed on IIS so no need to port to .NET Core.
Also relevant is Elastic Beanstalk for .NET Core on Linux; this one does require a .NET Core port and will allow customers to use the handy scaling features of the Elastic Beanstalk service.
However, the porting assistant itself promises more than it delivers; most of the work of porting is still down to the developer, and it is not especially smart when you dig into how it works.
We found it surprising that the project AWS chose to demonstrate the tool in its publicity is the open-source nopCommerce, which in fact has already been updated for .NET Core and runs on Windows and Linux, so AWS used an old version. It did work nicely with the visualisation, though. ®