Skip to content

Commit 00e34bd

Browse files
adegeoKSchlobohmCopilot
authored
Merge GHCP customize upgrade article with latest folder structure (#49046)
* add doc to describe custom upgrade instructions * update ms.author * unique alt text * rename images * rename images * unique alt text * update image to use new message * created how-to doc * clarify wording * fix file name * removed old doc * aligned images with the doc * adjust image paths * Apply suggestion from @Copilot Co-authored-by: Copilot <[email protected]> * Apply suggestion from @Copilot Co-authored-by: Copilot <[email protected]> * Fix feedback issues * Acro edit * Merge with latest folder structure * Fix references; edit for examples; bullets * Fix last links --------- Co-authored-by: Ken Schlobohm <[email protected]> Co-authored-by: Copilot <[email protected]>
1 parent 905d0e3 commit 00e34bd

File tree

11 files changed

+139
-7
lines changed

11 files changed

+139
-7
lines changed

docs/azure/migration/appmod/containerization.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ In this quickstart, you learn how to containerize your project using GitHub Copi
2222

2323
Before you begin, make sure you have:
2424

25-
[!INCLUDE[github-copilot-app-mod-prereqs](../../../core/porting/github-copilot-app-modernization/includes/prereqs.md)]
25+
[!INCLUDE [github-copilot-app-modernization-prereqs](../../../includes/github-copilot-app-modernization-prereqs.md)]
2626

2727
## Containerize your project
2828

docs/azure/migration/appmod/deploy.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ In this quickstart, you learn how to deploy your project to Azure with GitHub Co
1414

1515
## Prerequisites
1616

17-
[!INCLUDE[github-copilot-app-mod-prereqs](../../../core/porting/github-copilot-app-modernization/includes/prereqs.md)]
17+
[!INCLUDE [github-copilot-app-modernization-prereqs](../../../includes/github-copilot-app-modernization-prereqs.md)]
1818

1919
## Deploy your project
2020

docs/azure/migration/appmod/quickstart.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ In this quickstart, you assess and migrate a .NET project by using GitHub Copilo
1919

2020
## Prerequisites
2121

22-
[!INCLUDE[github-copilot-app-mod-prereqs](../../../core/porting/github-copilot-app-modernization/includes/prereqs.md)]
22+
[!INCLUDE [github-copilot-app-modernization-prereqs](../../../includes/github-copilot-app-modernization-prereqs.md)]
2323

2424
## Assess app readiness
2525

Lines changed: 128 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,128 @@
1+
---
2+
title: How to apply custom upgrade instructions during an upgrade
3+
description: "Learn how to apply custom upgrade instructions with GitHub Copilot app modernization so they're executed automatically during a .NET upgrade."
4+
author: kschlobohm
5+
ms.author: adegeo
6+
ms.topic: how-to
7+
ms.date: 10/09/2025
8+
ai-usage: ai-assisted
9+
10+
#customer intent: As a developer, I want to apply custom upgrade instructions during a .NET upgrade so that I can automate specific changes consistently.
11+
12+
---
13+
14+
# Apply custom upgrade instructions during a .NET upgrade
15+
16+
GitHub Copilot app modernization executes reusable, task-focused guidance stored as custom upgrade instruction files. During an upgrade, incorporate these instructions into the generated plan so Copilot applies opinionated replacements, refactorings, or policy-driven changes. For example, replacing `Newtonsoft.Json` with `System.Text.Json`.
17+
18+
This article shows how to create a custom upgrade instruction, test it with a fast inner loop, and apply it automatically during a full upgrade.
19+
20+
## Prerequisites
21+
22+
Before you begin, ensure you have these requirements:
23+
24+
[!INCLUDE [github-copilot-app-modernization-prereqs](../../../includes/github-copilot-app-modernization-prereqs.md)]
25+
26+
## Understand custom upgrade instructions
27+
28+
Custom upgrade instructions are markdown files that Copilot retrieves on demand while planning or executing an upgrade. They differ from `copilot-instructions.md` because they're:
29+
30+
- Targeted to automating code and dependency changes.
31+
- Retrieved only when relevant to the current user request or plan modification.
32+
- Reusable across solutions when copied into each repository.
33+
34+
Structure your instruction files with:
35+
36+
- A short title describing the action. For example, "replace Newtonsoft.Json with System.Text.Json."
37+
- A concise problem statement or prerequisite section.
38+
- Explicit step logic ("If X is found, do Y")—avoid vague language.
39+
- (Recommended) One or more diff examples captured from actual local edits to guide transformations.
40+
41+
## Create a custom upgrade instruction
42+
43+
Follow these steps to generate and refine a new instruction file. These sections focus on replacing `Newtonsoft.Json` with `System.Text.Json` to explain this feature with an example.
44+
45+
1. In the **Solution Explorer** window, right-click the **solution** > **Modernize**.
46+
1. In the chat, type: `I want to generate a custom upgrade instruction`.
47+
1. When asked, provide a scenario like `I want to replace Newtonsoft with System.Text.Json` to have Copilot create the file.
48+
1. (Optional) Add the file to the solution for visibility if it isn't already included.
49+
1. When Copilot creates the new file, such as `replace_newtonsoft_with_system_text_json.md`, review the content and refine it in chat. For example, ask Copilot to "clarify detection criteria" or "add a prerequisite section."
50+
1. (Recommended) Strengthen the instruction with a real diff example:
51+
1. Make the desired code changes manually in one project. For example, "remove the `Newtonsoft.Json` package, update using directives, and replace `JsonConvert` code with `JsonSerializer`."
52+
1. In chat, with the instruction file open, type: `Check my git changes and add diffs as examples to my instruction file`.
53+
1. Confirm Copilot used a git diff and appended a fenced diff block or structured example to the markdown file.
54+
55+
### Authoring tips
56+
57+
- Use clear conditional phrasing: "If code references X, then do Y."
58+
- Keep one transformation per file; use prerequisites when multiple files must run in sequence.
59+
- Provide at least one concrete example (diff or before/after snippet) to improve transformation accuracy.
60+
- Avoid ambiguous verbs like "improve" or "fix"—use explicit actions like replace, remove, update.
61+
62+
## Test a custom upgrade instruction (one-time run)
63+
64+
Before running the instruction during an upgrade plan, validate it in isolation. This fast inner loop helps you refine detection and validate the code changes.
65+
66+
1. In the **Solution Explorer** window, right-click the **solution** > **Modernize**.
67+
1. In chat, invoke the instruction using wording similar to the file name. For example, "replace Newtonsoft with System.Text.Json."
68+
1. Confirm in the chat window that Copilot retrieved the instruction file (it shows the text "Getting more instructions"). If it didn't, retry by using the key words from the file's name such as using the same verb (replace/update/remove) and nouns (Newtonsoft/System.Text.Json).
69+
1. Review the proposed changes (solution diffs, pending commits, or previewed modifications) to validate the custom upgrade instruction behaves as planned.
70+
71+
### Validation tips
72+
73+
- If Copilot only updates package versions instead of performing a replacement, ensure the instruction explicitly says to remove or replace the old package.
74+
- Use consistent naming so natural language activation matches. For example, the file name starts with `replace_` and your chat request begins with "Replace ...".
75+
- Add missing code patterns you discover during testing as more examples to improve coverage.
76+
77+
## Apply custom instructions during an upgrade
78+
79+
Use these steps to incorporate an existing custom upgrade instruction into an upgrade plan.
80+
81+
1. In the **Solution Explorer** window, right-click the **solution** > **Modernize**.
82+
1. In the chat, choose `Upgrade to a newer version of .NET`. Answer Copilot's questions until it generates the plan markdown file.
83+
1. Review the generated plan. Confirm whether the intended transformation is already present. If it only lists a version bump, your custom instruction wasn't yet applied.
84+
1. In chat, explicitly reference the instruction using language similar to the file name. For example, "modify the plan using the custom instructions to replace Newtonsoft with System.Text.Json."
85+
1. Wait for Copilot to confirm it retrieved the file. In chat, you see that it opened the markdown instruction file. If you don't see a reference, restate the request using the file's key verbs (replace, update, remove) and package names.
86+
1. Review the plan file and verify that it includes the custom instruction's details.
87+
88+
- Review package actions.
89+
90+
For example, when replacing Newtonsoft, the plan switches from a version upgrade to replacing or removing the package.
91+
92+
The plan may have started as version upgrade, as illustrated in the following image:
93+
94+
:::image type="content" source="./media/how-to-custom-upgrade-instructions/visualstudio-copilot-upgrade6.png" alt-text="The screenshot shows the project-level (feature) actions added by the custom upgrade instruction. Projects that previously referenced Newtonsoft.Json are now slated for code refactoring to use System.Text.Json APIs.":::
95+
96+
But then the plan changes to remove the package:
97+
98+
:::image type="content" source="./media/how-to-custom-upgrade-instructions/visualstudio-copilot-upgrade5.png" alt-text="The screenshot shows the effect of applying a custom upgrade instruction to the upgrade plan. Instead of upgrading Newtonsoft.Json, the plan now removes it and incorporates System.Text.Json as the replacement, explicitly listing the package removal and corresponding additions/changes that occur during execution.":::
99+
100+
- Review execution steps. Any new execution steps referencing the transformation appear under the plan's step list.
101+
102+
1. Tell Copilot to proceed with the upgrade once the plan reflects your custom instruction.
103+
1. Monitor the **Upgrade Progress Details**. If Copilot pauses due to conflicts or compilation errors, resolve issues and instruct it to continue.
104+
105+
### Tips for better activation
106+
107+
- Match the file's verb: if the file name uses replace, use that phrasing (not upgrade or fix).
108+
- Keep one transformation per file for clarity and reuse; sequence multiple files by listing prerequisites in each file.
109+
- Ask Copilot to modify the plan rather than manually editing; this reduces the risk of breaking dependency ordering.
110+
- Avoid ambiguous requests like "improve the plan"; be explicit: "apply the replace_newtonsoft_with_system_text_json instructions."
111+
112+
## Validate the applied changes
113+
114+
After the upgrade completes:
115+
116+
1. Review the upgrade report for commits related to the custom instruction.
117+
1. Run your tests to ensure functional behavior remains correct.
118+
1. (Optional) Capture a diff example from the successful change and add it to the instruction file to strengthen future automation.
119+
120+
## Clean up resources
121+
122+
If you created temporary instruction files for experimentation, remove or consolidate them to avoid overlapping transformations in future upgrades.
123+
124+
## Related content
125+
126+
- [How to upgrade a .NET app with GitHub Copilot app modernization](how-to-upgrade-with-github-copilot.md)
127+
- [GitHub Copilot app modernization FAQ](faq.yml)
128+
- [What is GitHub Copilot app modernization](overview.md)

docs/core/porting/github-copilot-app-modernization/how-to-upgrade-with-github-copilot.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ ai-usage: ai-assisted
1111

1212
---
1313

14-
# How to upgrade a .NET app with GitHub Copilot app modernization
14+
# Upgrade a .NET app with GitHub Copilot app modernization
1515

1616
GitHub Copilot app modernization is an AI-powered agent in Visual Studio that helps you upgrade .NET projects to newer versions and migrate applications to Azure. This article guides you through the process of using this tool to modernize your .NET applications, from initial assessment to final validation.
1717

@@ -21,7 +21,7 @@ The modernization agent analyzes your projects and dependencies, creates an upgr
2121

2222
Before you begin, ensure you have the following requirements:
2323

24-
[!INCLUDE[github-copilot-app-mod-prereqs](./includes/prereqs.md)]
24+
[!INCLUDE [github-copilot-app-modernization-prereqs](../../../includes/github-copilot-app-modernization-prereqs.md)]
2525

2626
## Start the upgrade process
2727

docs/core/porting/github-copilot-app-modernization/index.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ metadata:
77
title: Use GitHub Copilot to upgrade and migrate .NET apps
88
description: Learn about updating and migrating .NET apps with GitHub Copilot.
99
ms.topic: landing-page
10-
ms.date: 09/15/2025
10+
ms.date: 10/09/2025
1111

1212
landingContent:
1313

@@ -23,6 +23,8 @@ landingContent:
2323
links:
2424
- text: How to upgrade a .NET app
2525
url: how-to-upgrade-with-github-copilot.md
26+
- text: How to apply custom upgrade instructions
27+
url: how-to-custom-upgrade-instructions.md
2628

2729
- title: Migrate .NET apps to Azure
2830
linkLists:
364 KB
Loading
268 KB
Loading

docs/core/porting/github-copilot-app-modernization/overview.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ Feedback is important to Microsoft and the efficiency of this agent. Use the [Su
4444

4545
The following items are required before you can use GitHub Copilot app modernization:
4646

47-
[!INCLUDE[github-copilot-app-mod-prereqs](./includes/prereqs.md)]
47+
[!INCLUDE [github-copilot-app-modernization-prereqs](../../../includes/github-copilot-app-modernization-prereqs.md)]
4848

4949
## How to start an upgrade or migration
5050

docs/core/porting/github-copilot-app-modernization/toc.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ items:
1212
items:
1313
- name: How to upgrade with GitHub Copilot
1414
href: how-to-upgrade-with-github-copilot.md
15+
- name: How to apply custom upgrade instructions
16+
href: how-to-custom-upgrade-instructions.md
1517

1618
- name: Migrate .NET apps to Azure
1719
expanded: true

0 commit comments

Comments
 (0)