You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
packages migrate-cpm silently upgrades per-target-framework package versions to the highest one #250
After running ktools packages migrate-cpm --path .:
Directory.Packages.props contains only 9.0.0.
Both versions are removed from the csproj.
dotnet restore succeeds, and project.assets.json shows net8.0 now resolving 9.0.0.
Nothing in the output reports the change. Two projects that pin different versions are also collapsed to the maximum, with the same silence.
Why it matters
Giving each target framework its own version is the standard multi-targeting pattern. The migration silently upgrades the dependency on the lower target framework. That can pull in packages the framework doesn't support, or ones that require a newer runtime.
Suggested fix / acceptance criteria
Detect packages declared with more than one version, whether per condition or per project.
Preserve those versions, either as VersionOverride on the non-default ones or as conditional PackageVersion items. At minimum, print a warning table of every version that was collapsed.
Add a test: after migrating the conditional example above, net8.0 still resolves 8.0.1.
Priority: High. The migration silently changes resolved dependency versions on lower target frameworks. Restore still succeeds, so the user gets no signal, and the change can ship packages the framework doesn't support.
Area / suggested owner:KtsuTools.Packages/PackagesService.cs (migrate-cpm).
Next step: Detect packages that have more than one version, either per condition or per project. Preserve them with VersionOverride or conditional PackageVersion items, and at minimum print a warning table. Add the net8.0/net9.0 restore test.
Activity
matt-edmondson commentedon Oct 6, 2026
Triage
KtsuTools.Packages/PackagesService.cs(migrate-cpm).migrate-cpmcorrectness issues:packages migrate-cpmdrops the XML declaration and converts CRLF to LF in every csproj, and misses<Version>child elements #213 (XML declaration/CRLF),packages migrate-cpmwrites duplicate PackageVersion entries when projects spell a package ID with different casing (restore fails with NU1506) #229 (casing duplicates, NU1506),packages updateand the migrate-cpm props merge strip the UTF-8 BOM from every csproj/props they rewrite #231 (BOM stripping), and packages update finds nothing to update in a Central Package Management repo (including ones migrate-cpm produces) #224 (packages updatein CPM repos). These are worth batching into one migrate-cpm hardening pass.VersionOverrideor conditionalPackageVersionitems, and at minimum print a warning table. Add the net8.0/net9.0 restore test.Generated by Claude Code