NuKeeperDotNet / NuKeeper

Automagically update nuget packages in .NET projects
Apache License 2.0
540 stars 128 forks source link

Different package versions over various solutions won't be updated by NuKeeper with Major configuration #1105

Closed kwlin closed 3 years ago

kwlin commented 3 years ago

🐛 Bug Report

During a NuKeeper run with the change configuration Major, we saw the following scenario with our Git Repo:

Solution A with nuget Package:

Solution B with nuget Package:

Available package in de nuget repository: Package version 1.3

Only solution B is upgraded with the latests nuget package and Solution A isn't upgraded.

Expected behavior

Our assumption was that the although there was different versions of the same nuget packages ==> Solution A & B will be updated by NuKeeper.

Reproduction steps

Configuration

Version: 0.34.0

Platform if applicable:

kwlin commented 3 years ago

The issue seems here:

https://github.com/NuKeeperDotNet/NuKeeper/blob/c189fdaa0a276bcb31f53a77b56168deacb6bd0b/NuKeeper.Inspection/NuGetApi/BulkPackageLookup.cs#L32-L37

When the configuration change is set Major, only the highest packages within your solutions will be returned and those exact packages will be updated according this code:

https://github.com/NuKeeperDotNet/NuKeeper/blob/c189fdaa0a276bcb31f53a77b56168deacb6bd0b/NuKeeper.Inspection/NuGetApi/PackageUpdatesLookup.cs#L40-L42

Fix suggestion is:

The BulkPackageLookup should return all the matching packages that could be updated.

Or the class PackageUpdatesLookup should not check full package id but only on the package name when the change is Major. For example:

                var updatesForThisPackage = (allowedChange == VersionChange.Major
                    ? packages.Where(p => p.Identity.Id == packageId.Id && p.Version < matchVersion) // When major version change, just verify package name
                    : packages.Where(p => p.Identity.Equals(packageId.Id) && p.Version < matchVersion)) // Or verify full package identity (name & version)
                    .ToList();

Tagging @CrispyDrone because last changes by you 👍 Any advice how to fix, so I can make a PR.

stale[bot] commented 3 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.