|
| 1 | +--- |
| 2 | +ms.topic: include |
| 3 | +ms.date: 01/26/2026 |
| 4 | +title: GitHub Copilot App Modernization for .NET in VS Code |
| 5 | +description: Learn how to assess .NET app readiness and migrate to Azure with GitHub Copilot in Visual Studio Code. Follow step-by-step guidance for seamless modernization. |
| 6 | +--- |
| 7 | + |
| 8 | +## Prerequisites |
| 9 | + |
| 10 | +- A GitHub account with an active [GitHub Copilot](https://github.com/features/copilot) subscription under any plan. |
| 11 | +- The latest version of [Visual Studio Code](https://code.visualstudio.com/). Must be version 1.101 or later. |
| 12 | + |
| 13 | + - [GitHub Copilot in Visual Studio Code](https://code.visualstudio.com/docs/copilot/overview). For setup instructions, see [Set up GitHub Copilot in VisualStudio Code](https://code.visualstudio.com/docs/copilot/setup). Be sure to sign in to your GitHub account within Visual Studio Code. |
| 14 | + - [GitHub Copilot app modernization](https://marketplace.visualstudio.com/items?itemName=vscjava.migrate-java-to-azure). Restart Visual Studio Code afterinstallation. |
| 15 | + |
| 16 | +- A .NET development environment to build and test the project. |
| 17 | + |
| 18 | +## Assess app readiness |
| 19 | + |
| 20 | +GitHub Copilot app modernization for .NET assessment helps you find app readiness challenges, learn their impact, and see recommended migration tasks. Each migration task includes references to set up Azure resources, add configurations, and make code changes. Follow these steps to start your migration: |
| 21 | + |
| 22 | +1. Clone the [.NET migration copilot samples](https://github.com/Azure-Samples/dotnet-migration-copilot-samples) repository to your computer. |
| 23 | + |
| 24 | +1. In Visual Studio Code, open the **Contoso University** solution from the samples repository. |
| 25 | + |
| 26 | +1. Open the **GitHub Copilot app modernization** extension. |
| 27 | + |
| 28 | +1. In the **QUICKSTART** section, select **Start Assessment**. The **Assessment reports** page opens. |
| 29 | + |
| 30 | +1. Select **Run Assessment** in the upper-right corner of the page. |
| 31 | + |
| 32 | + :::image type="content" source="../media/vscode/start-assessment.png" alt-text="Screenshot of run a task in tasks section to start a migration task."::: |
| 33 | + |
| 34 | +1. The assessment starts automatically and analyzes your project for migration readiness. |
| 35 | + |
| 36 | + :::image type="content" source="../media/vscode/assessment-in-process.png" alt-text="Screenshot of run a task analyzing your project for migration readiness."::: |
| 37 | + |
| 38 | +1. When the assessment finishes, you see a comprehensive assessment report UI page and a list of migration tasks in the chat window. |
| 39 | + |
| 40 | + :::image type="content" source="../media/vscode/assessment-report.png" alt-text="Screenshot of run an assessment report UI page and a list of migration tasks."::: |
| 41 | + |
| 42 | +## App migrations |
| 43 | + |
| 44 | +GitHub Copilot app modernization for .NET includes [predefined tasks](../predefined-tasks.md) for common migration scenarios and follows Microsoft's best practices. |
| 45 | + |
| 46 | +### Chat-based migration (recommended) |
| 47 | + |
| 48 | +Chat-based migration is the recommended way to start a migration. The `AppModernization-DotNet` custom agent is optimized for application modernization tasks. This agent lets you use simple, natural language prompts to perform complex migration scenarios. |
| 49 | + |
| 50 | +Complete the following steps to select the custom agent and start the migration: |
| 51 | + |
| 52 | +1. Make sure you have a .NET project open in Visual Studio Code. |
| 53 | + |
| 54 | +1. Select the chat icon in the **Activity Bar** to open the Copilot chat window. |
| 55 | + |
| 56 | +1. In the chat window, locate the agent selector dropdown menu at the top of the chat input box. Select **AppModernization-DotNet** from the list. This custom agent is designed for .NET application modernization and migration scenarios. |
| 57 | + |
| 58 | + :::image type="content" source="../media/vscode/custom-agent.png" alt-text="Screenshot of selecting the .NET custom agent in the chat window."::: |
| 59 | + |
| 60 | +1. Enter a prompt using the format `migrate from <source> to <target>` in the chat window. For example: |
| 61 | + |
| 62 | + ```text |
| 63 | + migrate from rabbitmq to Azure service bus |
| 64 | + ``` |
| 65 | + |
| 66 | +1. The agent analyzes your code, creates a migration plan, makes code changes, runs validations, and generates a summary. Select **Continue** to proceed through each step and **Keep** to accept the changes. |
| 67 | + |
| 68 | +### Start a migration task from the UI |
| 69 | + |
| 70 | +You can also start a migration task from the UI: |
| 71 | + |
| 72 | +**Option 1. Run from the Assessment Report** |
| 73 | + |
| 74 | +Select the **Run Task** button in the Assessment Report from the previous step to start a migration task. |
| 75 | + |
| 76 | +**Option 2. Apply a predefined task** |
| 77 | + |
| 78 | +Run the specific task in the **TASKS - .NET** section. For example, the **Migrate Database to Azure Database for PostgreSQL** task under **Database Tasks** updates your database connection, configurations, dependencies, and data access code to use Azure Database for PostgreSQL. |
| 79 | + |
| 80 | +:::image type="content" source="../media/vscode/run-task.png" alt-text="Screenshot of running a specific predefined task."::: |
| 81 | + |
| 82 | +### Plan and progress tracker generation |
| 83 | + |
| 84 | +When you start the migration, GitHub Copilot starts a session in agent mode. |
| 85 | + |
| 86 | +The tool creates two files in the `.github/appmod/code-migration/<target-branch-name>` folder: |
| 87 | + |
| 88 | +- `plan.md`: The overall migration plan. |
| 89 | +- `progress.md`: A progress tracker that GitHub Copilot updates as it completes tasks. |
| 90 | + |
| 91 | +Edit these files to customize your migration before you continue. |
| 92 | + |
| 93 | +:::image type="content" source="../media/vscode/start-migration.png" alt-text="Screenshot of plan generation during a migration task."::: |
| 94 | + |
| 95 | +### Start code remediation |
| 96 | + |
| 97 | +When you're satisfied with the plan and progress tracker, enter **continue** to start the migration. |
| 98 | + |
| 99 | +GitHub Copilot starts the migration process and might ask for your approval to use knowledge base tools in the Model Context Protocol (MCP) server. Grant permission when prompted. |
| 100 | + |
| 101 | +Copilot follows the plan and progress tracker to: |
| 102 | + |
| 103 | +- Manage dependencies. |
| 104 | +- Apply configuration changes. |
| 105 | +- Make code changes. |
| 106 | +- Build the project, fix all compilation and configuration errors, and ensure a successful build. |
| 107 | +- Fix security vulnerabilities. |
| 108 | + |
| 109 | +Repeatedly select or enter **Continue** to confirm the use of tools or commands and wait for the code changes to finish. |
| 110 | + |
| 111 | +> [!NOTE] |
| 112 | +> In Visual Studio Code, app modernization uses the `AppModernization-DotNet` custom agent with Claude Sonnet 4.5 by default for best results when updating .NET code to migrate to Azure. It falls back to the 'auto' model if Sonnet 4.5 isn't available to you. You can configure the custom agent to [modify the 'model' setting](https://code.visualstudio.com/docs/copilot/customization/custom-agents#_custom-agent-file-structure) by selecting **Configure Custom Agents** from the **Agent** menu. Alternatively, you can use the language model picker in the chat window to switch models for the current chat session. |
| 113 | +
|
| 114 | +### Validation iteration |
| 115 | + |
| 116 | +After the code changes finish, the migration tool starts a validation and fix iteration loop. This loop includes the following five steps: |
| 117 | + |
| 118 | +1. Detect Common Vulnerabilities and Exposures (CVEs) in current dependencies and fix them. |
| 119 | +1. Build the project and resolve any build errors. |
| 120 | +1. Analyze the code for functional consistency. |
| 121 | +1. Analyze the project for unit test failures and automatically generate a plan to fix them until the tests pass. |
| 122 | +1. Analyze the code for migration items missed in the initial code migration and fix them. |
| 123 | + |
| 124 | +After all processes complete, the migration tool generates a summary. Review the code changes and confirm them by selecting **Keep**. |
0 commit comments