Skip to content

fallout-migrate: CPM repos fail to restore after migration (NU1010); Directory.Packages.props & VersionOverride not rewritten #492

Description

@avidenic

Usage Information

fallout-migrate built from main (@ f072c9de), .NET SDK 10.0.203, macOS. Target repo uses Central Package Management (CPM): a Directory.Packages.props with <PackageVersion> items and version-less <PackageReference> items.

Description

For repos using Central Package Management, fallout-migrate rewrites the <PackageReference Include="Nuke.Common" ...> items in the .csproj to Fallout.Common, but does not update the matching <PackageVersion Include="Nuke.Common" ...> entry in Directory.Packages.props. Under CPM the PackageReference and PackageVersion item names must match, so restore fails with NU1010.

It also leaves a stale VersionOverride="9.0.4" on the rewritten reference, a Fallout.Common version that never existed (Fallout.Common starts at 10.x).

This is related to but distinct from #217 (which fixed inline Version= attributes on PackageReference): CPM central versions in Directory.Packages.props and VersionOverride attributes are still not handled.

Reproduction Steps

  1. A NUKE consumer using CPM:
    • Directory.Packages.props contains <PackageVersion Include="Nuke.Common" Version="10.1.0"/>
    • the .csproj contains <PackageReference Include="Nuke.Common" /> (and, in our case, a second <PackageReference Include="Nuke.Common" VersionOverride="9.0.4" />)
  2. Run fallout-migrate.
  3. dotnet restore the migrated project.

Result:

error NU1010: The following PackageReference items do not define a corresponding
PackageVersion item: Fallout.Common. Projects using Central Package Management must
declare PackageReference and PackageVersion items with matching names.

Expected Behavior

After migration, a CPM repo restores. fallout-migrate renames the <PackageVersion Include="Nuke.*"> entries in Directory.Packages.props to their Fallout.* equivalents (at a valid Fallout version), and updates or removes VersionOverride attributes that reference non-existent Fallout versions.

Actual Behavior

Directory.Packages.props is left untouched (still Nuke.Common), the csproj PackageReference is now Fallout.Common with no matching PackageVersion, and a bogus VersionOverride="9.0.4" remains, so restore fails with NU1010.

Regression?

No. This is an unhandled case (CPM), not a regression. #217 addressed inline Version= pins; CPM and VersionOverride remain.

Known Workarounds

Manually rename the <PackageVersion> entries in Directory.Packages.props (Nuke.* to Fallout.* at a valid version) and fix or remove the stale VersionOverride after running the tool.

Could you help with a pull-request?

Yes.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions