Skip to content

Commit f773b30

Browse files
kshashank57aaronpowellShashank Konjarla
authored
Add Instructions , Prompts, Chatmode options to Upgrade a dotnet solution to higher version (#322)
* Add .NET project upgrade instructions Added comprehensive instructions for upgrading .NET projects, including preparation steps, upgrade strategies, and handling breaking changes. * Add .NET Upgrade Prompts documentation This document provides a comprehensive set of prompts for analyzing, planning, executing, and validating framework upgrades for multi-project .NET solutions, covering various aspects from project discovery to final validation. * Create .NET Upgrade Chatmode Guidance document Added a comprehensive playbook for upgrading .NET projects, including guidance on discovery, analysis, upgrade sequences, and CI/CD configuration. * Enhance .NET Upgrade Chatmode Guidance Updated .NET upgrade chatmode guidance with detailed instructions and tools for project migration and modernization. * Revise .NET upgrade instructions and agent prompt Updated the instructions for .NET Framework upgrades to include a name and description for the specialized agent, and refined the prompt example for clarity. * Revise .NET Upgrade Prompts for clarity and completeness Updated prompts for .NET upgrade analysis, enhancing project classification, dependency review, and upgrade strategy sections. Added new prompts for CI/CD updates, testing, and documentation. * Updating README instructions --------- Co-authored-by: Aaron Powell <[email protected]> Co-authored-by: Shashank Konjarla <[email protected]>
1 parent bef8332 commit f773b30

File tree

5 files changed

+627
-0
lines changed

5 files changed

+627
-0
lines changed

README.chatmodes.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ Custom chat modes define specific behaviors and tools for GitHub Copilot Chat, e
1414

1515
| Title | Description |
1616
| ----- | ----------- |
17+
| [.NET Upgrade Collection](chatmodes/dotnet-upgrade.chatmode.md)<br />[![Install in VS Code](https://img.shields.io/badge/VS_Code-Install-0098FF?style=flat-square&logo=visualstudiocode&logoColor=white)](https://aka.ms/awesome-copilot/install/chatmode?url=vscode%3Achat-mode%2Finstall%3Furl%3Dhttps%3A%2F%2Fraw.githubusercontent.com%2Fgithub%2Fawesome-copilot%2Fmain%2Fchatmodes%2Fdotnet-upgrade.chatmode.md)<br />[![Install in VS Code Insiders](https://img.shields.io/badge/VS_Code_Insiders-Install-24bfa5?style=flat-square&logo=visualstudiocode&logoColor=white)](https://aka.ms/awesome-copilot/install/chatmode?url=vscode-insiders%3Achat-mode%2Finstall%3Furl%3Dhttps%3A%2F%2Fraw.githubusercontent.com%2Fgithub%2Fawesome-copilot%2Fmain%2Fchatmodes%2Fdotnet-upgrade.chatmode.md) | Perform janitorial tasks on C#/.NET code including cleanup, modernization, and tech debt remediation. |
1718
| [4.1 Beast Mode (VS Code v1.102)](chatmodes/4.1-Beast.chatmode.md)<br />[![Install in VS Code](https://img.shields.io/badge/VS_Code-Install-0098FF?style=flat-square&logo=visualstudiocode&logoColor=white)](https://aka.ms/awesome-copilot/install/chatmode?url=vscode%3Achat-mode%2Finstall%3Furl%3Dhttps%3A%2F%2Fraw.githubusercontent.com%2Fgithub%2Fawesome-copilot%2Fmain%2Fchatmodes%2F4.1-Beast.chatmode.md)<br />[![Install in VS Code Insiders](https://img.shields.io/badge/VS_Code_Insiders-Install-24bfa5?style=flat-square&logo=visualstudiocode&logoColor=white)](https://aka.ms/awesome-copilot/install/chatmode?url=vscode-insiders%3Achat-mode%2Finstall%3Furl%3Dhttps%3A%2F%2Fraw.githubusercontent.com%2Fgithub%2Fawesome-copilot%2Fmain%2Fchatmodes%2F4.1-Beast.chatmode.md) | GPT 4.1 as a top-notch coding agent. |
1819
| [Accessibility mode](chatmodes/accesibility.chatmode.md)<br />[![Install in VS Code](https://img.shields.io/badge/VS_Code-Install-0098FF?style=flat-square&logo=visualstudiocode&logoColor=white)](https://aka.ms/awesome-copilot/install/chatmode?url=vscode%3Achat-mode%2Finstall%3Furl%3Dhttps%3A%2F%2Fraw.githubusercontent.com%2Fgithub%2Fawesome-copilot%2Fmain%2Fchatmodes%2Faccesibility.chatmode.md)<br />[![Install in VS Code Insiders](https://img.shields.io/badge/VS_Code_Insiders-Install-24bfa5?style=flat-square&logo=visualstudiocode&logoColor=white)](https://aka.ms/awesome-copilot/install/chatmode?url=vscode-insiders%3Achat-mode%2Finstall%3Furl%3Dhttps%3A%2F%2Fraw.githubusercontent.com%2Fgithub%2Fawesome-copilot%2Fmain%2Fchatmodes%2Faccesibility.chatmode.md) | Accessibility mode. |
1920
| [API Architect mode instructions](chatmodes/api-architect.chatmode.md)<br />[![Install in VS Code](https://img.shields.io/badge/VS_Code-Install-0098FF?style=flat-square&logo=visualstudiocode&logoColor=white)](https://aka.ms/awesome-copilot/install/chatmode?url=vscode%3Achat-mode%2Finstall%3Furl%3Dhttps%3A%2F%2Fraw.githubusercontent.com%2Fgithub%2Fawesome-copilot%2Fmain%2Fchatmodes%2Fapi-architect.chatmode.md)<br />[![Install in VS Code Insiders](https://img.shields.io/badge/VS_Code_Insiders-Install-24bfa5?style=flat-square&logo=visualstudiocode&logoColor=white)](https://aka.ms/awesome-copilot/install/chatmode?url=vscode-insiders%3Achat-mode%2Finstall%3Furl%3Dhttps%3A%2F%2Fraw.githubusercontent.com%2Fgithub%2Fawesome-copilot%2Fmain%2Fchatmodes%2Fapi-architect.chatmode.md) | Your role is that of an API architect. Help mentor the engineer by providing guidance, support, and working code. |

README.instructions.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ Team and project-specific instructions to enhance GitHub Copilot's behavior for
1616
| ----- | ----------- |
1717
| [.NET Framework Development](instructions/dotnet-framework.instructions.md)<br />[![Install in VS Code](https://img.shields.io/badge/VS_Code-Install-0098FF?style=flat-square&logo=visualstudiocode&logoColor=white)](https://aka.ms/awesome-copilot/install/instructions?url=vscode%3Achat-instructions%2Finstall%3Furl%3Dhttps%3A%2F%2Fraw.githubusercontent.com%2Fgithub%2Fawesome-copilot%2Fmain%2Finstructions%2Fdotnet-framework.instructions.md)<br />[![Install in VS Code Insiders](https://img.shields.io/badge/VS_Code_Insiders-Install-24bfa5?style=flat-square&logo=visualstudiocode&logoColor=white)](https://aka.ms/awesome-copilot/install/instructions?url=vscode-insiders%3Achat-instructions%2Finstall%3Furl%3Dhttps%3A%2F%2Fraw.githubusercontent.com%2Fgithub%2Fawesome-copilot%2Fmain%2Finstructions%2Fdotnet-framework.instructions.md) | Guidance for working with .NET Framework projects. Includes project structure, C# language version, NuGet management, and best practices. |
1818
| [.NET MAUI](instructions/dotnet-maui.instructions.md)<br />[![Install in VS Code](https://img.shields.io/badge/VS_Code-Install-0098FF?style=flat-square&logo=visualstudiocode&logoColor=white)](https://aka.ms/awesome-copilot/install/instructions?url=vscode%3Achat-instructions%2Finstall%3Furl%3Dhttps%3A%2F%2Fraw.githubusercontent.com%2Fgithub%2Fawesome-copilot%2Fmain%2Finstructions%2Fdotnet-maui.instructions.md)<br />[![Install in VS Code Insiders](https://img.shields.io/badge/VS_Code_Insiders-Install-24bfa5?style=flat-square&logo=visualstudiocode&logoColor=white)](https://aka.ms/awesome-copilot/install/instructions?url=vscode-insiders%3Achat-instructions%2Finstall%3Furl%3Dhttps%3A%2F%2Fraw.githubusercontent.com%2Fgithub%2Fawesome-copilot%2Fmain%2Finstructions%2Fdotnet-maui.instructions.md) | .NET MAUI component and application patterns |
19+
| [.NET Project Upgrade Instructions](instructions/dotnet-upgrade.instructions.md)<br />[![Install in VS Code](https://img.shields.io/badge/VS_Code-Install-0098FF?style=flat-square&logo=visualstudiocode&logoColor=white)](https://aka.ms/awesome-copilot/install/instructions?url=vscode%3Achat-instructions%2Finstall%3Furl%3Dhttps%3A%2F%2Fraw.githubusercontent.com%2Fgithub%2Fawesome-copilot%2Fmain%2Finstructions%2Fdotnet-upgrade.instructions.md)<br />[![Install in VS Code Insiders](https://img.shields.io/badge/VS_Code_Insiders-Install-24bfa5?style=flat-square&logo=visualstudiocode&logoColor=white)](https://aka.ms/awesome-copilot/install/instructions?url=vscode-insiders%3Achat-instructions%2Finstall%3Furl%3Dhttps%3A%2F%2Fraw.githubusercontent.com%2Fgithub%2Fawesome-copilot%2Fmain%2Finstructions%2Fdotnet-upgrade.instructions.md) | Specialized agent for comprehensive .NET framework upgrades with progressive tracking and validation |
1920
| [AI Prompt Engineering & Safety Best Practices](instructions/ai-prompt-engineering-safety-best-practices.instructions.md)<br />[![Install in VS Code](https://img.shields.io/badge/VS_Code-Install-0098FF?style=flat-square&logo=visualstudiocode&logoColor=white)](https://aka.ms/awesome-copilot/install/instructions?url=vscode%3Achat-instructions%2Finstall%3Furl%3Dhttps%3A%2F%2Fraw.githubusercontent.com%2Fgithub%2Fawesome-copilot%2Fmain%2Finstructions%2Fai-prompt-engineering-safety-best-practices.instructions.md)<br />[![Install in VS Code Insiders](https://img.shields.io/badge/VS_Code_Insiders-Install-24bfa5?style=flat-square&logo=visualstudiocode&logoColor=white)](https://aka.ms/awesome-copilot/install/instructions?url=vscode-insiders%3Achat-instructions%2Finstall%3Furl%3Dhttps%3A%2F%2Fraw.githubusercontent.com%2Fgithub%2Fawesome-copilot%2Fmain%2Finstructions%2Fai-prompt-engineering-safety-best-practices.instructions.md) | Comprehensive best practices for AI prompt engineering, safety frameworks, bias mitigation, and responsible AI usage for Copilot and LLMs. |
2021
| [Angular Development Instructions](instructions/angular.instructions.md)<br />[![Install in VS Code](https://img.shields.io/badge/VS_Code-Install-0098FF?style=flat-square&logo=visualstudiocode&logoColor=white)](https://aka.ms/awesome-copilot/install/instructions?url=vscode%3Achat-instructions%2Finstall%3Furl%3Dhttps%3A%2F%2Fraw.githubusercontent.com%2Fgithub%2Fawesome-copilot%2Fmain%2Finstructions%2Fangular.instructions.md)<br />[![Install in VS Code Insiders](https://img.shields.io/badge/VS_Code_Insiders-Install-24bfa5?style=flat-square&logo=visualstudiocode&logoColor=white)](https://aka.ms/awesome-copilot/install/instructions?url=vscode-insiders%3Achat-instructions%2Finstall%3Furl%3Dhttps%3A%2F%2Fraw.githubusercontent.com%2Fgithub%2Fawesome-copilot%2Fmain%2Finstructions%2Fangular.instructions.md) | Angular-specific coding standards and best practices |
2122
| [Ansible Conventions and Best Practices](instructions/ansible.instructions.md)<br />[![Install in VS Code](https://img.shields.io/badge/VS_Code-Install-0098FF?style=flat-square&logo=visualstudiocode&logoColor=white)](https://aka.ms/awesome-copilot/install/instructions?url=vscode%3Achat-instructions%2Finstall%3Furl%3Dhttps%3A%2F%2Fraw.githubusercontent.com%2Fgithub%2Fawesome-copilot%2Fmain%2Finstructions%2Fansible.instructions.md)<br />[![Install in VS Code Insiders](https://img.shields.io/badge/VS_Code_Insiders-Install-24bfa5?style=flat-square&logo=visualstudiocode&logoColor=white)](https://aka.ms/awesome-copilot/install/instructions?url=vscode-insiders%3Achat-instructions%2Finstall%3Furl%3Dhttps%3A%2F%2Fraw.githubusercontent.com%2Fgithub%2Fawesome-copilot%2Fmain%2Finstructions%2Fansible.instructions.md) | Ansible conventions and best practices |
Lines changed: 222 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,222 @@
1+
---
2+
description: 'Perform janitorial tasks on C#/.NET code including cleanup, modernization, and tech debt remediation.'
3+
tools: ['codebase', 'edit/editFiles', 'search', 'runCommands', 'runTasks', 'runTests', 'problems', 'changes', 'usages', 'findTestFiles', 'testFailure', 'terminalLastCommand', 'terminalSelection', 'fetch', 'microsoft.docs.mcp']
4+
---
5+
6+
# .NET Upgrade Collection
7+
8+
.NET Framework upgrade specialist for comprehensive project migration
9+
10+
**Tags:** dotnet, upgrade, migration, framework, modernization
11+
12+
## Collection Usage
13+
14+
### .NET Upgrade Chat Mode
15+
16+
Discover and plan your .NET upgrade journey!
17+
18+
```markdown, upgrade-analysis.prompt.md
19+
---
20+
mode: dotnet-upgrade
21+
title: Analyze current .NET framework versions and create upgrade plan
22+
---
23+
Analyze the repository and list each project's current TargetFramework
24+
along with the latest available LTS version from Microsoft's release schedule.
25+
Create an upgrade strategy prioritizing least-dependent projects first.
26+
```
27+
28+
The upgrade chat mode automatically adapts to your repository's current .NET version and provides context-aware upgrade guidance to the next stable version.
29+
30+
It will help you:
31+
- Auto-detect current .NET versions across all projects
32+
- Generate optimal upgrade sequences
33+
- Identify breaking changes and modernization opportunities
34+
- Create per-project upgrade flows
35+
36+
---
37+
38+
### .NET Upgrade Instructions
39+
40+
Execute comprehensive .NET framework upgrades with structured guidance!
41+
42+
The instructions provide:
43+
- Sequential upgrade strategies
44+
- Dependency analysis and sequencing
45+
- Framework targeting and code adjustments
46+
- NuGet and dependency management
47+
- CI/CD pipeline updates
48+
- Testing and validation procedures
49+
50+
Use these instructions when implementing upgrade plans to ensure proper execution and validation.
51+
52+
---
53+
54+
### .NET Upgrade Prompts
55+
56+
Quick access to specialized upgrade analysis prompts!
57+
58+
The prompts collection includes ready-to-use queries for:
59+
- Project discovery and assessment
60+
- Upgrade strategy and sequencing
61+
- Framework targeting and code adjustments
62+
- Breaking change analysis
63+
- CI/CD pipeline updates
64+
- Final validation and delivery
65+
66+
Use these prompts for targeted analysis of specific upgrade aspects.
67+
68+
---
69+
70+
## Quick Start
71+
1. Run a discovery pass to enumerate all `*.sln` and `*.csproj` files in the repository.
72+
2. Detect the current .NET version(s) used across projects.
73+
3. Identify the latest available stable .NET version (LTS preferred) — usually `+2` years ahead of the existing version.
74+
4. Generate an upgrade plan to move from current → next stable version (e.g., `net6.0 → net8.0`, or `net7.0 → net9.0`).
75+
5. Upgrade one project at a time, validate builds, update tests, and modify CI/CD accordingly.
76+
77+
---
78+
79+
## Auto-Detect Current .NET Version
80+
To automatically detect the current framework versions across the solution:
81+
82+
```bash
83+
# 1. Check global SDKs installed
84+
dotnet --list-sdks
85+
86+
# 2. Detect project-level TargetFrameworks
87+
find . -name "*.csproj" -exec grep -H "<TargetFramework" {} \;
88+
89+
# 3. Optional: summarize unique framework versions
90+
grep -r "<TargetFramework" **/*.csproj | sed 's/.*<TargetFramework>//;s/<\/TargetFramework>//' | sort | uniq
91+
92+
# 4. Verify runtime environment
93+
dotnet --info | grep "Version"
94+
```
95+
96+
**Chat Prompt:**
97+
> "Analyze the repository and list each project’s current TargetFramework along with the latest available LTS version from Microsoft’s release schedule."
98+
99+
---
100+
101+
## Discovery & Analysis Commands
102+
```bash
103+
# List all projects
104+
dotnet sln list
105+
106+
# Check current target frameworks for each project
107+
grep -H "TargetFramework" **/*.csproj
108+
109+
# Check outdated packages
110+
dotnet list <ProjectName>.csproj package --outdated
111+
112+
# Generate dependency graph
113+
dotnet msbuild <ProjectName>.csproj /t:GenerateRestoreGraphFile /p:RestoreGraphOutputPath=graph.json
114+
```
115+
116+
**Chat Prompt:**
117+
> "Analyze the solution and summarize each project’s current TargetFramework and suggest the appropriate next LTS upgrade version."
118+
119+
---
120+
121+
## Classification Rules
122+
- `TargetFramework` starts with `netcoreapp`, `net5.0+`, `net6.0+`, etc. → **Modern .NET**
123+
- `netstandard*`**.NET Standard** (migrate to current .NET version)
124+
- `net4*`**.NET Framework** (migrate via intermediate step to .NET 6+)
125+
126+
---
127+
128+
## Upgrade Sequence
129+
1. **Start with Independent Libraries:** Least dependent class libraries first.
130+
2. **Next:** Shared components and common utilities.
131+
3. **Then:** API, Web, or Function projects.
132+
4. **Finally:** Tests, integration points, and pipelines.
133+
134+
**Chat Prompt:**
135+
> "Generate the optimal upgrade order for this repository, prioritizing least-dependent projects first."
136+
137+
---
138+
139+
## Per-Project Upgrade Flow
140+
1. **Create branch:** `upgrade/<project>-to-<targetVersion>`
141+
2. **Edit `<TargetFramework>`** in `.csproj` to the suggested version (e.g., `net9.0`)
142+
3. **Restore & update packages:**
143+
```bash
144+
dotnet restore
145+
dotnet list package --outdated
146+
dotnet add package <PackageName> --version <LatestVersion>
147+
```
148+
4. **Build & test:**
149+
```bash
150+
dotnet build <ProjectName>.csproj
151+
dotnet test <ProjectName>.Tests.csproj
152+
```
153+
5. **Fix issues** — resolve deprecated APIs, adjust configurations, modernize JSON/logging/DI.
154+
6. **Commit & push** PR with test evidence and checklist.
155+
156+
---
157+
158+
## Breaking Changes & Modernization
159+
- Use `.NET Upgrade Assistant` for initial recommendations.
160+
- Apply analyzers to detect obsolete APIs.
161+
- Replace outdated SDKs (e.g., `Microsoft.Azure.*``Azure.*`).
162+
- Modernize startup logic (`Startup.cs``Program.cs` top-level statements).
163+
164+
**Chat Prompt:**
165+
> "List deprecated or incompatible APIs when upgrading from <currentVersion> to <targetVersion> for <ProjectName>."
166+
167+
---
168+
169+
## CI/CD Configuration Updates
170+
Ensure pipelines use the detected **target version** dynamically:
171+
172+
**Azure DevOps**
173+
```yaml
174+
- task: UseDotNet@2
175+
inputs:
176+
packageType: 'sdk'
177+
version: '$(TargetDotNetVersion).x'
178+
```
179+
180+
**GitHub Actions**
181+
```yaml
182+
- uses: actions/setup-dotnet@v4
183+
with:
184+
dotnet-version: '${{ env.TargetDotNetVersion }}.x'
185+
```
186+
187+
---
188+
189+
## Validation Checklist
190+
- [ ] TargetFramework upgraded to next stable version
191+
- [ ] All NuGet packages compatible and updated
192+
- [ ] Build and test pipelines succeed locally and in CI
193+
- [ ] Integration tests pass
194+
- [ ] Deployed to a lower environment and verified
195+
196+
---
197+
198+
## Branching & Rollback Strategy
199+
- Use feature branches: `upgrade/<project>-to-<targetVersion>`
200+
- Commit frequently and keep changes atomic
201+
- If CI fails after merge, revert PR and isolate failing modules
202+
203+
**Chat Prompt:**
204+
> "Suggest a rollback and validation plan if the .NET upgrade for <ProjectName> introduces build or runtime regressions."
205+
206+
---
207+
208+
## Automation & Scaling
209+
- Automate upgrade detection with GitHub Actions or Azure Pipelines.
210+
- Schedule nightly runs to check for new .NET releases via `dotnet --list-sdks`.
211+
- Use agents to automatically raise PRs for outdated frameworks.
212+
213+
---
214+
215+
## Chatmode Prompt Library
216+
1. "List all projects with current and recommended .NET versions."
217+
2. "Generate a per-project upgrade plan from <currentVersion> to <targetVersion>."
218+
3. "Suggest .csproj and pipeline edits to upgrade <ProjectName>."
219+
4. "Summarize build/test results post-upgrade for <ProjectName>."
220+
5. "Create PR description and checklist for the upgrade."
221+
222+
---

0 commit comments

Comments
 (0)