Microsoft Workloads on AWS
Accelerate .NET modernization with AWS Toolkit for .NET Refactoring
Today we are announcing the general availability of AWS Toolkit for .NET Refactoring, an extension for Visual Studio 2019 and Visual Studio 2022. This extension helps transform your legacy .NET Framework applications to a modern, cloud-optimized architecture, letting you fully leverage the benefits of reduced cost, increased uptime, and improved scalability.
Enterprises are looking to modernize their legacy applications to take full advantage of the cloud. However, modernization is a complex process, typically involving refactoring a monolithic architecture, finding cross-platform replacements for Windows-specific dependencies, and updating application configurations to run in a container or serverless environment. Throughout this process, developers need to continually test and validate their changes.
AWS Toolkit for .NET Refactoring enables an end-to-end modernization workflow directly within Visual Studio. The extension evaluates .NET Framework applications for refactoring into modern .NET (formerly named .NET Core), translates IIS and Active Directory configurations to work with Linux and other open-source technologies, and helps package .NET Framework applications into containers. When possible, the extension reduces the manual effort required to refactor legacy .NET Framework applications by automatically upgrading NuGet packages and updating IIS-specific configurations to work with Kestrel and nginx. At each step in the modernization process, you can iteratively validate the changes by testing the application on AWS. The new extension automatically generates artifacts to containerize your application and run it on Amazon Elastic Container Service (Amazon ECS) with AWS Fargate.
The AWS Toolkit for .NET Refactoring extension supports ASP.NET MVC, Web Forms, WCF, and Web application types for assessment and porting. Any .NET applications listening on TCP connections can be deployed on AWS through the test deployment capabilities of the toolkit.
We asked for feedback from early access testers. Derya Sezen, an Advanced AWS Consulting Partner at Kloia, said:
“The AWS Toolkit for .NET Refactoring extension makes the life of developers easier who are seeking to update their legacy .NET applications by providing useful information and guidance to refactor and validate modernization efforts.”
Ananth Deodhar, Sr. Software Technical Architect at SourceFuse, said:
“The AWS Toolkit for .NET extension is a MASSIVE step up from the previous way of dealing with issues when migrating/modernizing .NET codebases. There is zero learning curve for developers or reliance on outside tooling, and our developers can now truly focus on solving issues without leaving the IDE.”
Using the AWS Toolkit for .NET Refactoring
After installing AWS Toolkit for .NET Refactoring, open a project in Visual Studio 2019 or 2022. The extension supports all types of applications, including console apps, Web applications, and class libraries. In this example, I’ve opened a standard ASP.NET (.NET Framework) MVC Web application.
In the Extensions menu, select AWS Toolkit for .NET Refactoring Extension, then select Get Started. On the Getting Started screen, select your AWS credentials, either by using a named profile or existing AWS CLI/SDK credentials. Then, select Next.
On the Dashboard screen, note that the Web application is ready to be assessed. Select Start assessment. AWS Toolkit for .NET Refactoring assesses the application for compatibility with your target .NET version (Core 3.1, 5, or 6), and displays a report covering NuGet packages and APIs.
To port your application to a cross-platform version of .NET, select Port, then select Port Solution. After the porting process runs, select Reload All to reload the new project in Visual Studio.
The sample Web application has now been ported to .NET 6. All of the controllers have been ported to use the .NET 6 APIs. The startup code in Global.ascx.cs
and the App_Start
folder has been ported to Program.cs
and Startup.cs
. Configuration settings in the appSettings
section of Web.config
have been copied into appsettings.json
, the configuration file used by ASP.NET Core.
I built the sample application to detect any compile-time errors. I made a few manual changes to the application, including changing the ASP.NET @Scripts.Render
and @Styles.Render
directives to use standard HTML tags, and updating appsettings.json
to remove the certificate settings so Kestrel uses the default ASP.NET Core development certificate.
As I was making these changes, I remembered that the file system on Linux is case-sensitive, but on Windows, the default file system is case-insensitive. I double-checked that paths in href
and src
attributes exactly matched the paths on disk, including using the correct case.
Test the ported application on AWS
Now that the application has been ported, you can test it on AWS to ensure that everything is working properly.
Before you begin this part of the tutorial, complete the one-time setup steps from the documentation on Setting up for testing on AWS.
After the setup steps are complete, open the context (right-click) menu on the project in the Visual Studio Solution Explorer and choose Publish. Create a Folder profile (or use an existing one), and publish the project to that directory.
After successfully publishing, select the icon after the Target location path to copy the full path to the clipboard. You’ll use this path in the next step.
In the Extensions menu, select AWS Toolkit for .NET Refactoring, then select Run Test Deployment on AWS. This new feature deploys your .NET application into a Linux container running on Amazon Elastic Container Service (Amazon ECS) with AWS Fargate, the serverless compute engine for containers. AWS Toolkit for .NET Refactoring generates all of the required artifacts to containerize your application and run it on Amazon ECS. You don’t need to create a Dockerfile, or even have Docker installed at all (although if you do have a Dockerfile already, you can use it).
In the Test on AWS window, select an AWS profile with Administrator-level access to your AWS account. Under Published artifacts, paste the path from the Target location field in the publish profile, or browse to the folder containing the published artifacts.
In the Port number field, enter the port that the application listens on. For ASP.NET Core Web applications, this is typically the Kestrel port.
Finally, select Test on AWS to begin the deployment. You can monitor the progress of the deployment from within Visual Studio. Once the deployment has completed, select View now to open a Web browser to your application on AWS.
To view the deployment later, in the Extensions menu, select AWS Toolkit for .NET Refactoring, then select View Deployments Running on AWS. In the table, select the URL under Endpoint URL to load the deployed application.
Updates to Porting Assistant for .NET
In 2020, AWS launched Porting Assistant for .NET, an open-source tool for analyzing the compatibility of .NET Framework applications and estimating the effort required to port them to modern .NET (or .NET Core). If you have used this tool, you may be wondering how it is related to the new AWS Toolkit for .NET Refactoring.
As Porting Assistant for .NET has gained popularity, we have heard two common pieces of feedback from the developer community. First, a compatibility assessment is only a starting point for modernization. Developers need more capabilities, such as iterative deployment and testing, to complete the modernization process. Second, the requirement to provide AWS credentials to use Porting Assistant for .NET added friction to the beginning of the modernization workflow.
We have listened to community feedback on both points. The AWS Toolkit for .NET Refactoring provides developers with unified tooling that aims to simplify the end-to-end modernization workflow. This new extension uses AWS credentials to automate tasks such as cloud deployment. At the same time, we have updated Porting Assistant for .NET to remove the requirement for an AWS account. This means developers can use Porting Assistant for .NET for any modernization project, with no dependency on AWS.
We will continue expanding and contributing to Porting Assistant for .NET. We believe the entire community benefits from collective contributions to this broad problem space, so every .NET community member and developer can continue to freely use and contribute to Porting Assistant for .NET.
Developers should use Porting Assistant for .NET when they want to use an open-source tool to evaluate the scope of a .NET modernization effort, visualize dependencies within a solution, and perform an assisted port of .NET Framework to modern .NET (or .NET Core).
Developers should use the AWS Toolkit for .NET Refactoring if they have chosen to modernize and migrate their .NET Framework applications to AWS, if they are evaluating AWS as a target for modernization and migration, or if they want to learn about running modernized .NET applications on the AWS cloud. The new extension includes the functionality of Porting Assistant for .NET and adds new features, such as testing on AWS containers. Our vision is that the AWS Toolkit for .NET Refactoring will continue to evolve and grow, becoming the hub for .NET modernization and migration on AWS.
Conclusion
The new AWS Toolkit for .NET Refactoring extension, available today, helps developers transform their legacy .NET Framework applications to fully benefit from the cost savings, reliability, and scalability of the cloud. The extension assesses the changes needed to port your .NET Framework application to modern .NET (formerly named .NET Core), updates Windows-specific configurations to work with open-source technologies, and automates creating and deploying a test environment based on AWS container services.
The AWS Toolkit for .NET Refactoring extension is available for Visual Studio 2019 and Visual Studio 2022. Porting Assistant for .NET remains an open-source tool available to the community, and can now be used without an AWS account.
AWS can help you assess how your company can get the most out of cloud. Join the millions of AWS customers that trust us to migrate and modernize their most important applications in the cloud. To learn more on modernizing Windows Server or SQL Server, visit Windows on AWS. Contact us to start your modernization journey today.