Fallout-build / Fallout-build/Fallout

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

Open
#492 0 comments 0 reactions 1 assignee Claimed by @avidenic View on GitHub
bug
Dominant language
C#
Stars
154
Forks
19
Avg merge
1d 22h
Merged PRs (30d)
15

Description

### 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 `` items and version-less `` items.

### Description

For repos using Central Package Management, `fallout-migrate` rewrites the `` items in the `.csproj` to `Fallout.Common`, but does not update the matching `` 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 ``
- the `.csproj` contains `` (and, in our case, a second ``)
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 `` 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 `` 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.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.