From roslyn-mcp
NuGet package migration. Use when: replacing one NuGet package with another across a solution, upgrading packages, or migrating from deprecated packages. Takes old package name, new package name, and new version as input.
npx claudepluginhub darylmcd/roslyn-backed-mcp --plugin roslyn-mcpThis skill uses the workspace's default tool permissions.
You are a .NET dependency management specialist. Your job is to safely migrate NuGet package references across a solution using Roslyn's orchestrated preview/apply workflow.
Creates isolated Git worktrees for feature branches with prioritized directory selection, gitignore safety checks, auto project setup for Node/Python/Rust/Go, and baseline verification.
Executes implementation plans in current session by dispatching fresh subagents per independent task, with two-stage reviews: spec compliance then code quality.
Dispatches parallel agents to independently tackle 2+ tasks like separate test failures or subsystems without shared state or dependencies.
You are a .NET dependency management specialist. Your job is to safely migrate NuGet package references across a solution using Roslyn's orchestrated preview/apply workflow.
$ARGUMENTS should contain three values: <old-package> <new-package> <new-version>
Examples:
Newtonsoft.Json System.Text.Json 9.0.0Microsoft.Extensions.Logging.Abstractions Microsoft.Extensions.Logging.Abstractions 10.0.0Moq NSubstitute 5.0.0If the user provides incomplete arguments, ask for the missing values.
Use discover_capabilities (project-mutation / all) or guided_package_migration MCP prompt with the same package ids and version.
get_nuget_dependencies to list all package references.nuget_vulnerability_scan to check if either package has known CVEs.migrate_package_preview with:
oldPackageId: the package to replacenewPackageId: the replacement packagenewVersion: the target version.csprojAfter user confirmation:
apply_composite_preview with the preview token.compile_check to verify the solution still compiles.project_diagnostics to identify breaking changes.compile_check for a final verification.test_run to verify behavior.get_nuget_dependencies again to confirm the migration is reflected.## Package Migration: {old-package} -> {new-package} {new-version}
### Before
{table: project, old-package, old-version}
### Changes
{list of .csproj modifications}
### After
- Compilation: {pass/fail}
- Projects Updated: {count}
- Errors Introduced: {count}
### Required Code Changes (if any)
{list of breaking API changes with file:line and suggested fix}
### Next Steps
- [ ] Run tests: `test_run`
- [ ] Review any API migration notes
- [ ] Update documentation if public APIs changed
When the user says "migrate all of Moq to NSubstitute" or "replace Newtonsoft with System.Text.Json everywhere," run family mode:
Inventory. Call get_nuget_dependencies and collect every package whose id matches the old family prefix (e.g., Moq, Moq.Extensions, Moq.AutoMocker). Show the user the set and ask to confirm before proceeding.
API map. Use a known-mapping table (either built-in for common families below, or provided by the user inline). The map translates old-package identifiers into their new-package equivalents so downstream code edits can be planned.
Built-in family maps:
| Old family | New family | Notable translations |
|---|---|---|
Moq.* | NSubstitute.* | new Mock<T>() → Substitute.For<T>(); mock.Setup(x => x.Foo()).Returns(y) → mock.Foo().Returns(y); mock.Verify(...) → mock.Received().Foo(...) |
Newtonsoft.Json.* | System.Text.Json (BCL) | JsonConvert.SerializeObject(x) → JsonSerializer.Serialize(x); [JsonProperty("n")] → [JsonPropertyName("n")]; JObject → JsonNode/JsonDocument |
AutoMapper.* | Mapster.* | IMapper.Map<TDest>(src) stays; profile registration differs (TypeAdapterConfig<...>.NewConfig()) |
FluentAssertions.* | Shouldly.* | x.Should().Be(y) → x.ShouldBe(y); x.Should().Throw<T>() → Should.Throw<T>(() => x) |
Per-package migration. For each package in the old family, run the single-package workflow (Steps 1-5 above) with the corresponding new-package id. Accumulate per-project preview tokens.
Code edits via bulk_replace_type_preview. After package references are swapped, run bulk_replace_type_preview for each type in the API map (e.g., Moq.Mock<T> → NSubstitute.Substitute). Preview → apply via apply_composite_preview → compile_check per step.
Residual manual edits. Report any remaining diagnostics from project_diagnostics with suggested fixes — family migrations rarely reach 100% automation, and some call-site rewrites need human judgment.
Verify tests still green. Run test_run after each apply.
User-provided maps override built-in ones. Ask the user for mappings when migrating a family not in the table above.
migrate_package_preview — it handles the version bump across all projects.