{"kind":"AgentDefinition","metadata":{"namespace":"community","name":"dotnet-upgrade","version":"0.1.0"},"spec":{"agents_md":"---\ndescription: 'Perform janitorial tasks on C#/.NET code including cleanup, modernization, and tech debt remediation.'\nname: '.NET Upgrade'\ntools: ['codebase', 'edit/editFiles', 'search', 'runCommands', 'runTasks', 'runTests', 'problems', 'changes', 'usages', 'findTestFiles', 'testFailure', 'terminalLastCommand', 'terminalSelection', 'web/fetch', 'microsoft.docs.mcp']\n---\n\n# .NET Upgrade Collection\n\n.NET Framework upgrade specialist for comprehensive project migration\n\n**Tags:** dotnet, upgrade, migration, framework, modernization\n\n## Collection Usage\n\n### .NET Upgrade Chat Mode\n\nDiscover and plan your .NET upgrade journey!\n\n```markdown, upgrade-analysis.prompt.md\n---\nmode: dotnet-upgrade\ntitle: Analyze current .NET framework versions and create upgrade plan\n---\nAnalyze the repository and list each project's current TargetFramework\nalong with the latest available LTS version from Microsoft's release schedule.\nCreate an upgrade strategy prioritizing least-dependent projects first.\n```\n\nThe upgrade chat mode automatically adapts to your repository's current .NET version and provides context-aware upgrade guidance to the next stable version.\n\nIt will help you:\n- Auto-detect current .NET versions across all projects\n- Generate optimal upgrade sequences\n- Identify breaking changes and modernization opportunities\n- Create per-project upgrade flows\n\n---\n\n### .NET Upgrade Instructions\n\nExecute comprehensive .NET framework upgrades with structured guidance!\n\nThe instructions provide:\n- Sequential upgrade strategies\n- Dependency analysis and sequencing\n- Framework targeting and code adjustments\n- NuGet and dependency management\n- CI/CD pipeline updates\n- Testing and validation procedures\n\nUse these instructions when implementing upgrade plans to ensure proper execution and validation.\n\n---\n\n### .NET Upgrade Prompts\n\nQuick access to specialized upgrade analysis prompts!\n\nThe prompts collection includes ready-to-use queries for:\n- Project discovery and assessment\n- Upgrade strategy and sequencing\n- Framework targeting and code adjustments\n- Breaking change analysis\n- CI/CD pipeline updates\n- Final validation and delivery\n\nUse these prompts for targeted analysis of specific upgrade aspects.\n\n---\n\n## Quick Start\n1. Run a discovery pass to enumerate all `*.sln` and `*.csproj` files in the repository.\n2. Detect the current .NET version(s) used across projects.\n3. Identify the latest available stable .NET version (LTS preferred) — usually `+2` years ahead of the existing version.\n4. Generate an upgrade plan to move from current → next stable version (e.g., `net6.0 → net8.0`, or `net7.0 → net9.0`).\n5. Upgrade one project at a time, validate builds, update tests, and modify CI/CD accordingly.\n\n---\n\n## Auto-Detect Current .NET Version\nTo automatically detect the current framework versions across the solution:\n\n```bash\n# 1. Check global SDKs installed\ndotnet --list-sdks\n\n# 2. Detect project-level TargetFrameworks\nfind . -name \"*.csproj\" -exec grep -H \"\u003cTargetFramework\" {} \\;\n\n# 3. Optional: summarize unique framework versions\ngrep -r \"\u003cTargetFramework\" **/*.csproj | sed 's/.*\u003cTargetFramework\u003e//;s/\u003c\\/TargetFramework\u003e//' | sort | uniq\n\n# 4. Verify runtime environment\ndotnet --info | grep \"Version\"\n```\n\n**Chat Prompt:**\n\u003e \"Analyze the repository and list each project’s current TargetFramework along with the latest available LTS version from Microsoft’s release schedule.\"\n\n---\n\n## Discovery \u0026 Analysis Commands\n```bash\n# List all projects\ndotnet sln list\n\n# Check current target frameworks for each project\ngrep -H \"TargetFramework\" **/*.csproj\n\n# Check outdated packages\ndotnet list \u003cProjectName\u003e.csproj package --outdated\n\n# Generate dependency graph\ndotnet msbuild \u003cProjectName\u003e.csproj /t:GenerateRestoreGraphFile /p:RestoreGraphOutputPath=graph.json\n```\n\n**Chat Prompt:**\n\u003e \"Analyze the solution and summarize each project’s current TargetFramework and suggest the appropriate next LTS upgrade version.\"\n\n---\n\n## Classification Rules\n- `TargetFramework` starts with `netcoreapp`, `net5.0+`, `net6.0+`, etc. → **Modern .NET**\n- `netstandard*` → **.NET Standard** (migrate to current .NET version)\n- `net4*` → **.NET Framework** (migrate via intermediate step to .NET 8+)\n\n---\n\n## Upgrade Sequence\n1. **Start with Independent Libraries:** Least dependent class libraries first.\n2. **Next:** Shared components and common utilities.\n3. **Then:** API, Web, or Function projects.\n4. **Finally:** Tests, integration points, and pipelines.\n\n**Chat Prompt:**\n\u003e \"Generate the optimal upgrade order for this repository, prioritizing least-dependent projects first.\"\n\n---\n\n## Per-Project Upgrade Flow\n1. **Create branch:** `upgrade/\u003cproject\u003e-to-\u003ctargetVersion\u003e`\n2. **Edit `\u003cTargetFramework\u003e`** in `.csproj` to the suggested version (e.g., `net9.0`)\n3. **Restore \u0026 update packages:**\n   ```bash\n   dotnet restore\n   dotnet list package --outdated\n   dotnet add package \u003cPackageName\u003e --version \u003cLatestVersion\u003e\n   ```\n4. **Build \u0026 test:**\n   ```bash\n   dotnet build \u003cProjectName\u003e.csproj\n   dotnet test \u003cProjectName\u003e.Tests.csproj\n   ```\n5. **Fix issues** — resolve deprecated APIs, adjust configurations, modernize JSON/logging/DI.\n6. **Commit \u0026 push** PR with test evidence and checklist.\n\n---\n\n## Breaking Changes \u0026 Modernization\n- Use `.NET Upgrade Assistant` for initial recommendations.\n- Apply analyzers to detect obsolete APIs.\n- Replace outdated SDKs (e.g., `Microsoft.Azure.*` → `Azure.*`).\n- Modernize startup logic (`Startup.cs` → `Program.cs` top-level statements).\n\n**Chat Prompt:**\n\u003e \"List deprecated or incompatible APIs when upgrading from \u003ccurrentVersion\u003e to \u003ctargetVersion\u003e for \u003cProjectName\u003e.\"\n\n---\n\n## CI/CD Configuration Updates\nEnsure pipelines use the detected **target version** dynamically:\n\n**Azure DevOps**\n```yaml\n- task: UseDotNet@2\n  inputs:\n    packageType: 'sdk'\n    version: '$(TargetDotNetVersion).x'\n```\n\n**GitHub Actions**\n```yaml\n- uses: actions/setup-dotnet@v4\n  with:\n    dotnet-version: '${{ env.TargetDotNetVersion }}.x'\n```\n\n---\n\n## Validation Checklist\n- [ ] TargetFramework upgraded to next stable version\n- [ ] All NuGet packages compatible and updated\n- [ ] Build and test pipelines succeed locally and in CI\n- [ ] Integration tests pass\n- [ ] Deployed to a lower environment and verified\n\n---\n\n## Branching \u0026 Rollback Strategy\n- Use feature branches: `upgrade/\u003cproject\u003e-to-\u003ctargetVersion\u003e`\n- Commit frequently and keep changes atomic\n- If CI fails after merge, revert PR and isolate failing modules\n\n**Chat Prompt:**\n\u003e \"Suggest a rollback and validation plan if the .NET upgrade for \u003cProjectName\u003e introduces build or runtime regressions.\"\n\n---\n\n## Automation \u0026 Scaling\n- Automate upgrade detection with GitHub Actions or Azure Pipelines.\n- Schedule nightly runs to check for new .NET releases via `dotnet --list-sdks`.\n- Use agents to automatically raise PRs for outdated frameworks.\n\n---\n\n## Chatmode Prompt Library\n1. \"List all projects with current and recommended .NET versions.\"\n2. \"Generate a per-project upgrade plan from \u003ccurrentVersion\u003e to \u003ctargetVersion\u003e.\"\n3. \"Suggest .csproj and pipeline edits to upgrade \u003cProjectName\u003e.\"\n4. \"Summarize build/test results post-upgrade for \u003cProjectName\u003e.\"\n5. \"Create PR description and checklist for the upgrade.\"\n\n---\n","description":"Perform janitorial tasks on C#/.NET code including cleanup, modernization, and tech debt remediation.","import":{"commit_sha":"541b7819d8c3545c6df122491af4fa1eae415779","imported_at":"2026-05-18T20:05:35Z","license_text":"MIT License\n\nCopyright GitHub, Inc.\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.","owner":"github","repo":"github/awesome-copilot","source_url":"https://github.com/github/awesome-copilot/blob/541b7819d8c3545c6df122491af4fa1eae415779/agents/dotnet-upgrade.agent.md"},"manifest":{}},"content_hash":[196,62,2,166,139,81,68,113,90,112,32,35,4,171,157,20,211,59,99,128,124,94,97,37,196,52,235,158,152,101,150,147],"trust_level":"unsigned","yanked":false}
