Skip to content

Find a .nupkg's dependencies in the packages folder for enum defaults - #112

Merged
Mpdreamz merged 1 commit into
mainfrom
nupkg-dependencies
Nov 15, 2026
Merged

Mpdreamz merged 1 commit into
mainfrom
nupkg-dependencies

Conversation

@Mpdreamz

Copy link
Copy Markdown
Contributor

Follow-up to #111. A .nupkg read on its own (assembly-differ api MyLib.1.2.0.nupkg) wrote an enum default from a dependency as a cast unless -r named the folder. It now finds its dependencies itself:

  • It reads the package's dependency group for each framework (the nearest one, as restore picks it), and does the same for each dependency in turn, transitively.
  • It looks for each one in the packages folder restore fills: ~/.nuget/packages, NUGET_PACKAGES, or what NuGet.config says.
  • It takes the version restore would: the lowest the range allows, among versions whose restore finished (.nupkg.metadata present).
  • It reads the dependency's ref/ assemblies when it has them, otherwise lib/, for the nearest framework.
  • Nothing is downloaded: a dependency that is not in the folder is skipped, and its enums stay casts, as before. -r still adds folders on top.

Verified:

  • A_package_finds_its_dependencies_in_the_packages_folder packs a real project whose package declares the enum:
    • with the restored packages folder it writes Mode.Auto;
    • with an empty one it writes (Mode)5, with no error.
  • A_package_takes_the_version_restore_would_through_its_dependencies_dependencies uses a hand-made packages folder:
    • Uses depends on Middle, which depends on Modes [1.1.0, );
    • Modes is there at 1.0.0, at 1.1.0 with an unfinished restore, at 1.2.0 and at 2.0.0, and each declares value 5 under a different name;
    • so the name written tells which version was read, and it is 1.2.0.
  • Mutations caught: taking the highest version, taking an unfinished restore, not following dependencies' dependencies, and not passing the folders to the reader.
  • Checked by hand on a packed library that depends on Newtonsoft.Json.
  • mise run ci is green locally.

🤖 Generated with Claude Code

A .nupkg read on its own now looks for its dependencies, and theirs, in the packages folder restore fills
(~/.nuget/packages, or NUGET_PACKAGES), at the version restore would pick: the lowest the range allows, among the
versions restore finished. Nothing is downloaded; a dependency that is not there leaves its enums as casts.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Mpdreamz Mpdreamz added the feature A new capability (minor bump) label Nov 15, 2026
@Mpdreamz
Mpdreamz merged commit 2038a42 into main Nov 15, 2026
8 checks passed
@Mpdreamz
Mpdreamz deleted the nupkg-dependencies branch November 15, 2026 10:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature A new capability (minor bump)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant