

# Transforming .NET applications with Amazon Q Developer
<a name="transform-dotnet-IDE"></a>

Amazon Q Developer can port your Windows-based .NET applications to Linux-compatible cross-platform .NET applications through a generative AI-powered refactoring workflow. Amazon Q also helps you upgrade outdated versions of cross-platform .NET applications to newer versions. 

To transform a .NET solution or project, Amazon Q analyzes your codebase, determines the necessary updates to port your application, and generates a transformation plan before the transformation begins. During this analysis, Amazon Q divides your .NET solution or project into code groups that you can view in the transformation plan. A *code group* is a project and all its dependencies that together generate a buildable unit of code such as a dynamic link library (DLL) or an executable. 

During the transformation, Amazon Q provides step-by-step updates in a Transformation Hub where you can monitor progress. After transforming your application, Amazon Q generates a summary with the proposed changes in a diff view for you to optionally verify the changes before you accept them. When you accept the changes, Amazon Q makes in-place updates to your .NET solution or project. 

Amazon Q performs four keys tasks to port .NET applications to Linux:
+ **Upgrades language version** – Replaces outdated C\$1 versions of code with Linux-compatible C\$1 versions.
+ **Migrates from .NET Framework to cross-platform .NET** – Migrates projects and packages from Windows dependent .NET Framework to cross-platform .NET compatible with Linux.
+ **Rewrites code for Linux compatibility** – Refactors and rewrites deprecated and inefficient code components.
+ **Generates a Linux compatibility readiness report **– For open-ended tasks where user intervention is needed to make the code build and run on Linux, Amazon Q provides a detailed report of actions needed to configure your application after transformation.

For more information about how Amazon Q performs .NET transformations, see [How it works](how-dotnet-transformation-works.md). 

**Topics**
+ [Quotas](#quotas-dotnet-transformation)
+ [Porting a .NET application with Amazon Q Developer in Visual Studio](port-dotnet-application.md)
+ [How Amazon Q Developer transforms .NET applications](how-dotnet-transformation-works.md)
+ [Troubleshooting issues with .NET transformations in the IDE](troubleshooting-dotnet-transformation-IDE.md)

## Quotas
<a name="quotas-dotnet-transformation"></a>

.NET transformations with Amazon Q in the IDE maintain the following quotas: 
+ **Lines of code per job** – The maximum number of code lines that Amazon Q can transform in a given transformation job. This is also the monthly total limit for .NET transformations. 
+ **Concurrent jobs** – The maximum number of transformation jobs you can run at the same time. This quota applies to all transformations in the IDE, including [Java transformations](transform-java.md).


| Resource | Quotas | 
| --- | --- | 
| Lines of code per job | 100,000 lines of code | 
| Concurrent jobs |  1 job per user 2 jobs per AWS account  | 

# Porting a .NET application with Amazon Q Developer in Visual Studio
<a name="port-dotnet-application"></a>

Complete these steps to port a Windows-based .NET application to a Linux-compatible cross-platform .NET application with Amazon Q Developer in Visual Studio. 

## Step 1: Prerequisites
<a name="transform-dotnet-prerequisites"></a>

Before you continue, make sure you’ve completed the steps in [Set up Amazon Q in your IDE](https://docs.aws.amazon.com/amazonq/latest/qdeveloper-ug/q-in-IDE.html).

Make sure that the following prerequisites for your application are met before you begin a .NET transformation job:
+ Your application contains only .NET projects written in C\$1.
+ Your application only has Microsoft-authored NuGet package dependencies 
+ Your application only uses UTF-8 characters. If your application uses non-UTF-8 characters, Amazon Q will still attempt to transform your code.
+ If your application is dependent on Internet Information Services (IIS), only default IIS configurations are used
+ Amazon Q will evaluate the type of the project you selected and its dependencies to create a code group. Your code group can only have the following project types:
  + Console application
  + Class library 
  + Web API
  + WCF Service
  + Business logic layers of Model View Controller (MVC) and Single Page Application (SPA)
  + Test projects

**Note**  
Amazon Q doesn’t support transforming UI layer components such as Razor views or WebForms ASPX files. If Amazon Q detects UI layer components in your solution or project, it will perform a partial transformation by excluding UI layer components, and you might need to refactor further to make your code buildable on the target .NET version.

## Step 2: Transform your application
<a name="transform-dotnet-app"></a>

To transform your .NET solution or project, complete the following procedure:

1. Open any C\$1 based solution or project in Visual Studio that you want to transform. 

1. Open any C\$1 code file in the editor. 

1. Choose **Solution Explorer**.

1. From the Solution Explorer, right click a solution or project you want to transform, and then choose **Port with Amazon Q Developer**.

1. The **Port with Amazon Q Developer** window appears. 

   The solution or project you selected will be chosen in the **Choose a solution or project to transform** dropdown menu. You can expand the menu to choose a different solution or project to transform. 

   In the **Choose a .NET target** dropdown menu, choose the .NET version you want to upgrade to.

1. Choose **Confirm** to begin the transformation.

1. Amazon Q begins transforming your code. You can view the transformation plan it generates for details about how it will transform your application.

   A **Transformation Hub** opens where you can monitor progress for the duration of the transformation. After Amazon Q has completed the **Awaiting job transformation startup** step, you can navigate away from the project or solution for the duration of the transformation.

1. After the transformation is complete, navigate to the **Transformation Hub** and choose **View diffs** to review the proposed changes from Amazon Q in a diff view. 

1. Choose **View code transformation summary** for details about the changes Amazon Q made. You can also download the transformation summary by choosing **Download summary as .md**. 

   If any of the items in the **Code groups** table require input under the Linux porting status, you must manually update some files to run your application on Linux. 

   1. From the **Actions** dropdown menu, choose **Download Linux readiness report**. 

   1. A .csv file opens with any changes to your project or solution that you must complete before your application is Linux compatible. It includes the project and file that need to be updated, a description of the item to be updated, and an explanation of the issue. Use the **Recommendation** column for ideas on how to address a Linux readiness issue. 

1. To update your files in place, choose **Accept changes** from the **Actions** dropdown menu. 

# How Amazon Q Developer transforms .NET applications
<a name="how-dotnet-transformation-works"></a>

Review the following sections for details about how .NET transformation with Amazon Q Developer works. 

## Analyzing your application and generating a transformation plan
<a name="analyzing-app-generating-plan"></a>

Before a transformation begins, Amazon Q builds your code locally to ensure it’s buildable and configured correctly for transformation. Amazon Q then uploads your code to a secure and encrypted build environment on AWS, analyzes your codebase, and determines the necessary updates to port your application. 

During this analysis, Amazon Q divides your .NET solution or project into code groups. A code group is a project and all its dependencies that together generate a buildable unit of code such as a dynamic link library (DLL) or an executable. Even if you didn’t select all project dependencies to be transformed, Amazon Q determines the dependencies needed to build your selected projects and transforms them too, so that your transformed application will be buildable and ready for use.

After analyzing your code, Amazon Q generates a transformation plan that outlines the proposed changes that it will make, including a list of code groups and their dependencies that will be transformed. 

## Transforming your application
<a name="transforming-app"></a>

To start the transformation, Amazon Q builds your code again in the secure build environment to ensure it’s buildable remotely. Amazon Q then begins porting your application. It works from the bottom up, starting with the lowest level dependency. If Amazon Q runs into an issue with porting a dependency, it stops the transformation and provides information about what caused the error. 

The transformation includes the following updates to your application: 
+ Replacing outdated C\$1 versions of code with Linux-compatible C\$1 versions
+ Upgrading .NET Framework to cross-platform .NET, including: 
  + Identifying and iteratively replacing packages, libraries, and APIs
  + Upgrading and replacing NuGet packages and APIs
  + Transitioning to cross-platform runtime
  + Setting up middleware and updating runtime configurations
  + Replacing private or third-party packages 
  + Handling IIS and WCF components 
  + Debugging build errors
+ Rewriting code for Linux compatibility, including refactoring and rewriting deprecated and inefficient code to port existing code 

## Reviewing transformation summary and accepting changes
<a name="reviewing-summary-accepting-changes"></a>

After the transformation is complete, Amazon Q provides a transformation summary with information about the proposed updates it made to your application, including the number of files changed, packages updated, and APIs changed. It flags any unsuccessful transformations, including affected files or portions of files and the errors encountered during an attempted build. You can also view a build summary with build logs to learn more about what changes were made. 

The transformation summary also provides a Linux porting status, which indicates whether or not additional user input is needed to make the application Linux compatible. If any of the items in a code group require input from you, you download a Linux readiness report that contains Windows-specific considerations that Amazon Q could not address at build time. If input is needed for any code groups or files, review the report for details about what type of change still needs to be made and, if applicable, for recommendations for how to update your code. These changes must be made manually before your application can be run on Linux. 

You can review the proposed changes Amazon Q made in a diff view before accepting them as in-place updates to your files. After updating your files and addressing any items in the Linux readiness report, your application is ready to run on cross-platform .NET.

# Troubleshooting issues with .NET transformations in the IDE
<a name="troubleshooting-dotnet-transformation-IDE"></a>

Use the following sections to troubleshoot common issues with .NET transformations in the IDE with Amazon Q Developer.

## How do I know if a job is progressing?
<a name="job-progressing"></a>

If Amazon Q appears to be spending a long time on a step in the Transformation Hub, you can check whether the job is still active in the output logs. If diagnostic messages are being generated, the job is still active. 

To check the outputs, choose the **Output** tab in Visual Studio. In the **Show output from:** menu, choose **Amazon Q Language Client**.

The following screenshot shows an example of the outputs Amazon Q generates during a transformation.

![\[Screenshot of the Amazon Q Developer Code Transformation Hub, showing the output from the Amazon Q Language Client.\]](http://docs.aws.amazon.com/amazonq/latest/qdeveloper-ug/images/code-transform-troubleshoot4.png)


## Why are some projects not selected for transformation?
<a name="projects-not-selected"></a>

Amazon Q can only transform supported project types in the C\$1 language. Currently, Amazon Q does not support porting UI layer components or projects written in the VB.NET or F\$1 languages. For a list of supported project types and other prerequisites for transforming your .NET projects, see [Step 1: Prerequisites](port-dotnet-application.md#transform-dotnet-prerequisites).

## How can I get support if my project or solution isn’t transforming?
<a name="get-support"></a>

If you aren’t able to troubleshoot issues on your own, you can reach out to Support or your AWS account team to submit a support case. 

To get support, provide the transformation job ID so AWS can investigate a failed job. To find a transformation job ID, choose the **Output** tab in Visual Studio. In the **Show output from:** menu, choose **Amazon Q Language Client**.

## How can I prevent my firewall from interfering with transformation jobs?
<a name="firewall-inteference"></a>

If your organization uses a firewall, it might interfere with transformations in Visual Studio. You can temporarily disable security checks in Node.js to troubleshoot or test what is preventing the transformation from running. 

The environment variable `NODE_TLS_REJECT_UNAUTHORIZED` controls important security checks. Setting `NODE_TLS_REJECT_UNAUTHORIZED` to "0" disables Node.js's rejection of unauthorized TLS/SSL certificates. This means:
+ Self-signed certificates will be accepted
+ Expired certificates will be allowed
+ Certificates with mismatched hostnames will be permitted
+ Any other certificate validation errors will be ignored

If your proxy uses a self-certificate, you can set the following environment variables instead of disabling `NODE_TLS_REJECT_UNAUTHORIZED`:

```
NODE_OPTIONS = —use-openssl-ca
NODE_EXTRA_CA_CERTS = Path/To/Corporate/Certs
```

Otherwise, you must specify the CA certs used by the proxy to disable `NODE_TLS_REJECT_UNAUTHORIZED`.

**To disable NODE\$1TLS\$1REJECT\$1UNAUTHORIZED on Windows:**

1. Open the Start menu and search for **Environment Variables**.

1. Choose **Edit the system environment variables**.

1. In the **System Properties** window, choose **Environment Variables**.

1. Under **System variables**, choose **New**.

1. Set **Variable name** to NODE\$1TLS\$1REJECT\$1UNAUTHORIZED and **Variable value** to 0.

1. Choose **OK** to save the changes.

1. Restart Visual Studio.