Add Skill: Convert to Central Package Management (convert-to-cpm) - #28
Add Skill: Convert to Central Package Management (convert-to-cpm)#28jeffhandley wants to merge 14 commits into
Conversation
There was a problem hiding this comment.
Pull request overview
This PR introduces the convert-to-cpm skill to guide developers through migrating .NET projects to NuGet Central Package Management (CPM). The skill provides a structured workflow for centralizing package versions into a Directory.Packages.props file, handling version conflicts, MSBuild property decisions, and validation procedures.
Changes:
- Added
convert-to-cpmskill with comprehensive SKILL.md (96 lines) and 5 reference documentation files covering validation, MSBuild properties, Directory.Packages.props creation, baseline comparison, and audit complexities - Created 6 test scenarios across 3 difficulty levels (simple, moderate, advanced) demonstrating skill effectiveness with and without the skill loaded
- Included .gitignore configuration for generated test solutions
Reviewed changes
Copilot reviewed 26 out of 26 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| skills/convert-to-cpm/SKILL.md | Main skill definition with frontmatter, workflow steps, and validation checklist (96 lines, under 500 limit) |
| skills/convert-to-cpm/references/validation-and-errors.md | NuGet error codes and validation procedures for CPM conversion |
| skills/convert-to-cpm/references/msbuild-property-handling.md | Guidance for handling MSBuild properties during conversion |
| skills/convert-to-cpm/references/directory-packages-props.md | Instructions for creating and structuring Directory.Packages.props |
| skills/convert-to-cpm/references/baseline-comparison.md | Procedures for capturing and comparing package versions before/after conversion |
| skills/convert-to-cpm/references/audit-complexities.md | Checklist of complexities to identify during package reference auditing |
| tests/convert-to-cpm/README.md | Overview of test scenarios and evaluation instructions |
| tests/convert-to-cpm/.gitignore | Excludes generated test solutions from version control |
| tests/convert-to-cpm/simple-single-project/* | Test scenario for single-project conversion with example outputs |
| tests/convert-to-cpm/simple-solution/* | Test scenario for multi-project solution conversion |
| tests/convert-to-cpm/simple-packages-config/* | Test scenario demonstrating skill's refusal to convert packages.config projects |
| tests/convert-to-cpm/moderate-version-conflicts/* | Test scenario for handling version conflicts across projects |
| tests/convert-to-cpm/moderate-msbuild-properties/* | Test scenario for MSBuild property handling decisions |
| tests/convert-to-cpm/advanced-multi-complexity/* | Complex test scenario combining multiple conversion challenges |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
I used Copilot to find a good community repository where CPM migration could be particularly valuable, and it identified the Blazam-App/BLAZAM repository.
I committed 0d60430 to incorporate the feedback the exercise produced. |
Authoring process: - Researched the Agent Skills standard at agentskills.io and reviewed repo conventions - Studied the existing csharp-scripts skill and test structure as a reference implementation - Studied Microsoft's CPM documentation at learn.microsoft.com - Authored SKILL.md with a 9-step workflow covering scope determination through validation - Created 5 test scenarios across simple, moderate, and advanced tiers - Performed dry-run evaluation against all scenarios, identifying 15 findings - Applied all 15 fixes (4 gaps, 6 ambiguities, 5 improvements) to SKILL.md - Re-evaluated: 50 OK, 0 gaps, 0 ambiguities, 1 test fixture improvement - Updated test fixture to resolve the remaining finding - Final validation: 254 lines, 0 errors, 0 warnings Skill implementation (skills/convert-to-cpm/SKILL.md): - 9-step workflow: scope, CPM check, audit, create/update props, update projects, handle properties, restore/validate, cleanup, summary - Handles single projects, solutions, and full repositories - Audits packages with per-project detail table including version conflicts and security advisories - Flags CVE/security vulnerabilities and recommends patched versions - Supports MSBuild property-based versioning with inline vs keep decisions - Covers conditional PackageReference items across target frameworks - Discovers PackageReference in imported .props/.targets via Import chain scanning - Provides cross-platform commands (Unix and Windows/PowerShell) - Documents import order requirements for property references in Directory.Packages.props - Mentions dotnet new packagesprops as preferred creation method (.NET 8+) - Includes validation checklist and common pitfalls table Test scenarios (tests/convert-to-cpm/): - simple-single-project: 1 project, 3 packages, no conflicts - simple-solution: 3 projects via .sln, 5 packages, PrivateAssets preservation - moderate-version-conflicts: 4 projects, System.Text.Json version conflicts with CVE-2024-43485 advisory, AutoMapper major version conflict with VersionOverride - moderate-msbuild-properties: 2 projects using MSBuild properties for versioning in Directory.Build.props, inline vs keep decisions, property cleanup verification - advanced-multi-complexity: 5 projects combining version conflicts, MSBuild properties, conditional TFM PackageReference, shared Common.props imports, VersionOverride, and security advisory handling Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…ison Condensed SKILL.md using progressive disclosure: - Reduced from 254 lines / ~3937 tokens to 120 lines / ~1778 tokens - Extracted detailed procedural instructions into 5 focused reference files - Main file retains workflow decision logic with links to references loaded on demand - Follows agentskills.io progressive disclosure pattern: metadata -> instructions -> resources Added baseline build verification (new Step 2): - Requires clean build (dotnet clean && dotnet build) before any changes - Captures baseline.binlog for structured build artifact - Captures baseline-packages.json via dotnet list package --format json - Blocks conversion if baseline build fails Added post-conversion baseline comparison (Steps 8 and 10): - Step 8 produces after-cpm.binlog and after-cpm-packages.json from clean build - Step 10 compares baseline vs post-conversion package lists per project - Changes table shows version bumps, VersionOverride entries, added/removed packages - Unchanged table confirms version-neutral conversion for unmodified packages - Binlog files produced as artifacts for user review in MSBuild Structured Log Viewer Reference files created: - references/audit-complexities.md: 7 complexity categories for package auditing - references/baseline-comparison.md: dotnet list package comparison procedure, binlog production, artifact guidance, table formats for changes and unchanged packages - references/directory-packages-props.md: File creation (dotnet new packagesprops), placement rules, conditional versions, VersionOverride patterns - references/msbuild-property-handling.md: Property usage search, inline vs keep decisions, import order requirements, cleanup verification - references/validation-and-errors.md: NuGet error codes (NU1008, NU1010, NU1507), clean build validation, multi-TFM guidance, common pitfalls Workflow is now 10 steps (was 9): 1. Determine scope 2. Establish baseline build (new) 3. Check for existing CPM 4. Audit package references 5. Create or update Directory.Packages.props 6. Update project files 7. Handle MSBuild version properties 8. Restore and validate (now with binlog + package list capture) 9. Clean up obsolete properties 10. Summary and baseline comparison (expanded with diff tables) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…/comparison steps, add .gitignore for test solutions Package replacements across all skill references and test scenarios: - Serilog.AspNetCore -> OpenTelemetry.Extensions.Hosting 1.15.0 - Serilog (standalone) -> OpenTelemetry.Extensions.Hosting 1.15.0 - Swashbuckle.AspNetCore -> Microsoft.AspNetCore.OpenApi 8.0.24 - SerilogVersion MSBuild property -> OTelVersion - DIVersion updated from 8.0.1 to 9.0.0 (DI/Abstractions alignment) - Microsoft.AspNetCore.OpenApi uses 8.0.24 (not 9.x) for net8.0 compat Test fixture improvements: - Added Step 2 (baseline build with binlog) to all 5 with-skill.md files - Added Step 10 (package comparison table + binlog artifact links) to all 5 with-skill.md files - Expanded simple-solution without-skill.md with more realistic agent behavior - Standardized security fix terminology: table markers cite CVEs, prose references CVE IDs - Removed space-padded table formatting in favor of compact markdown with emojis Test solution infrastructure: - Added tests/convert-to-cpm/.gitignore to exclude src/ build artifacts - Added generation prompt to test README for recreating buildable solutions - All 5 test solutions verified to restore and build successfully Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…racy - Rename Step 10 and validation checklist from 'binlog comparison' to 'package list comparison' - Rewrite baseline-comparison.md: title to 'Baseline Comparison', lead with dotnet list package as primary comparison mechanism, position binlogs as supplementary artifacts for manual review/troubleshooting - Add brief definition of binlogs before the artifacts section - Fix Directory.Packages.props placement guidance: use first common ancestor of all .NET projects instead of assuming repository root (.git), since many repos nest source under src/ or similar - Update SKILL.md scope input and Step 1 to reference directory-scoped conversion - Standardize security fix terminology: table markers cite CVEs, prose uses 'security fix for CVE-...' Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…nario, fix commands Review findings addressed: 1. Fixed BlobsVersion grep step description in advanced scenario 2. Sorted PackageVersion entries alphabetically in all Directory.Packages.props outputs 3. Consolidated baseline-comparison.md to single-table format 4. Added solution file arguments and multi-line commands in test fixtures 5. Added Directory.Packages.props placement question for single-project scenario 6. Created simple-packages-config test scenario (packages.config rejection) 7. Use dotnet new packagesprops in simple-single-project workflow 8. Fixed More Info link text to match reference file title Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Use mix of .sln and .slnx across scenarios (simple-solution and moderate-msbuild-properties use .sln; moderate-version-conflicts and advanced-multi-complexity use .slnx) - Fix simple-solution package count from 5 to 6 - Fix advanced user response #2 to reference Azure.Storage.Blobs version - Add ImplicitUsings to advanced Directory.Build.props in audit and cleanup - Complete the advanced unchanged table with all expected package entries Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Fix 4 occurrences of Inventory.sln to Inventory.slnx in moderate-version-conflicts/with-skill.md for consistency with the scenario README and test solution - Update test README to only run skill evaluation when the user explicitly requests it Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Remove duplicated bash code blocks from Steps 2 and 8, linking to baseline-comparison.md instead - Merge Steps 7 (MSBuild property decisions) and 9 (cleanup) into a single step since both reference msbuild-property-handling.md - Condense Step 10 summary to reference baseline-comparison.md for procedure details - Reduces from 120 to 97 lines (10 steps to 9 steps) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Address code review feedback: fix 4 occurrences of Enterprise.sln to Enterprise.slnx in advanced-multi-complexity/with-skill.md for consistency with the scenario README and test solution. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…t, fix links - Instruct Step 6 to retain each file's existing indentation style and blank lines to keep diffs minimal - Instruct Step 9 to save the full summary as convert-to-cpm.md alongside binlog and JSON artifacts, suggesting its contents for a PR description - Strip en-us/ from learn.microsoft.com links in SKILL.md and validation-and-errors.md to make them culture-agnostic - Update all with-skill.md test expectations to include the convert-to-cpm.md create step and artifact mention Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Move skill from skills/convert-to-cpm/ to src/dotnet-msbuild/skills/convert-to-cpm/ and tests from tests/convert-to-cpm/ to src/dotnet-msbuild/tests/convert-to-cpm/ to match the repository layout established on main. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Replace manual test approach (README.md + with-skill.md + without-skill.md) with automated eval.yaml scenarios containing assertions and rubric items. Add committed test fixture files (.csproj, .sln, .slnx, .props) for each scenario with copy_test_files setup, replacing the git-ignored generated solutions. 6 scenarios converted: - simple-single-project: basic single project CPM conversion - simple-solution: multi-project solution conversion - simple-packages-config: negative test (packages.config rejection) - moderate-version-conflicts: version conflict resolution - moderate-msbuild-properties: MSBuild property version handling - advanced-multi-complexity: combined complexities (conflicts, properties, conditionals, shared props) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Introduce the
convert-to-cpmskill, which guides the migration of .NET projects to NuGet Central Package Management (CPM). It provides detailed workflow steps, auditing guidance, validation procedures, error handling, and test scenarios for various conversion complexities.Skill Evaluation:
convert-to-cpmSKILL.md Validation
nameconvert-to-cpm(14 chars, lowercase+hyphens)descriptionnameskills/convert-to-cpm/Test Solution Builds
Scenario Evaluation: With-Skill vs Without-Skill
simple-single-project ✅
With-skill adds baseline build capture (
-bl:baseline.binlog,baseline-packages.json), CPM existence check, structured audit presentation, user interaction about placement,dotnet new packagesprops, post-conversion comparison table, and binlog references. Without skill, the agent just creates the file and says "Done!" — no audit, no comparison, no validation rigor.simple-solution ✅
With-skill runs
dotnet sln list, establishes baseline, presents a 6-package audit table, preservesPrivateAssets="all", produces comparison tables. Without-skill skips baseline capture, doesn't present audit results, and gives a terse summary.simple-packages-config ✅
With-skill correctly detects
packages.config, refuses to proceed, and recommends Visual Studio migration. Without-skill incorrectly createsDirectory.Packages.propsdespite the project usingpackages.config— the skill prevents a harmful action.moderate-version-conflicts ✅
With-skill detects both version conflicts (System.Text.Json 10.0.1 vs 8.0.4, Azure.Identity 1.13.2 vs 1.10.0), flags CVE-2024-43485 on 8.0.4, and asks the user for each conflict before proceeding. Uses
VersionOverridewhen requested. Without-skill silently picks highest version without asking and doesn't mention the security advisory.moderate-msbuild-properties ✅
With-skill traces
$(OTelVersion)and$(DIVersion)toDirectory.Build.props, presents a table showing property vs. literal sources, asks about inline vs. keep for each property, preserves unrelated$(OutputPath), verifies no remaining references. Without-skill silently inlines everything without asking.advanced-multi-complexity ✅
With-skill audits all 6 complexities (3-way version conflict, Azure.Storage.Blobs mismatch, 2 MSBuild properties, conditional PackageReference, shared props file, non-version properties), asks about each decision point separately, uses conditional
PackageVersionfor Mvc.NewtonsoftJson, keeps$(HostingVersion)as property, moves Microsoft.Extensions.Logging from Common.props, preserves$(LangVersion)and$(ImplicitUsings). Without-skill silently bumps everything to latest without asking about any decisions.Key Differentiators
packages.configguardVersionOverrideusageBehavior Traceability
All key behaviors in the
with-skill.mdfiles are traceable to the SKILL.md or its reference docs:baseline-comparison.mdbaseline-comparison.mdmsbuild-property-handling.mdbaseline-comparison.mdbaseline-comparison.mdpackages.configguardaudit-complexities.mddirectory-packages-props.mdmsbuild-property-handling.md