Skip to content

Bump DemaConsulting.NuGet.Caching to 1.4.0 and enhance config handling#38

Merged
Malcolmnixon merged 2 commits into
mainfrom
fix/issue-37-nuget-config-discovery
Jul 10, 2026
Merged

Bump DemaConsulting.NuGet.Caching to 1.4.0 and enhance config handling#38
Malcolmnixon merged 2 commits into
mainfrom
fix/issue-37-nuget-config-discovery

Conversation

@Malcolmnixon

Copy link
Copy Markdown
Member

This pull request updates the NuGet package caching logic to better support project- or repository-local nuget.config files, aligning the package discovery process with how dotnet restore works. The main changes involve passing the directory containing packages.config as a root for nuget.config discovery, and updating dependencies.

NuGet config discovery improvements:

  • The InstallAsync and InstallPackageAsync methods in PackageInstaller now accept an optional configRoot parameter, which is used to locate a local nuget.config file, matching the behavior of dotnet restore. [1] [2]
  • The RunToolLogic method in Program.cs now determines the directory containing packages.config and passes it as configRoot to InstallAsync, ensuring local nuget.config files are discovered and used.
  • The call to NuGetCache.EnsureCachedAsync is updated to receive the configRoot parameter, improving cache resolution for local configurations.

Dependency updates:

  • The DemaConsulting.NuGet.Caching package reference is updated from version 1.3.0 to 1.4.0 in DemaConsulting.NuGetInstaller.csproj.

…irectory as config root

DemaConsulting.NuGet.Caching 1.4.0 fixes GitHub issue #37: EnsureCachedAsync previously
called Settings.LoadDefaultSettings(null), which never scanned the working directory
(or any ancestor) for a project/repo-local nuget.config - only machine/user-wide
settings were loaded, so repo-scoped package sources were silently invisible.

Bump the package reference to 1.4.0 and thread the directory containing
packages.config through PackageInstaller.InstallAsync/InstallPackageAsync as a new
optional configRoot parameter, forwarded to EnsureCachedAsync's root argument. This
ensures nuget-installer discovers a repo-local nuget.config the same way dotnet
restore does, regardless of the current working directory the tool is invoked from.

Verified end-to-end against a real repo with a repo-local nuget.config and JFrog
Artifactory sources: cleared the local NuGet cache, removed the output packages
folder, and confirmed nuget-installer downloads and installs the package correctly
using the released 1.4.0 package (not a project reference).

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings July 10, 2026 21:51

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This pull request updates NuGet package caching/config resolution so the installer discovers and applies a project- or repo-local nuget.config based on the directory containing packages.config, aligning behavior more closely with dotnet restore. It also bumps the caching dependency to pick up the updated config-handling behavior.

Changes:

  • Compute a configRoot (directory containing packages.config) in Program.RunToolLogic and pass it into installation.
  • Extend PackageInstaller.InstallAsync / InstallPackageAsync to accept and forward an optional configRoot into NuGetCache.EnsureCachedAsync.
  • Update DemaConsulting.NuGet.Caching from 1.3.0 to 1.4.0.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
src/DemaConsulting.NuGetInstaller/Program.cs Derives configRoot from the packages.config location and forwards it into the install flow.
src/DemaConsulting.NuGetInstaller/NuGet/PackageInstaller.cs Adds configRoot parameter plumbing to ensure caching honors local nuget.config discovery.
src/DemaConsulting.NuGetInstaller/DemaConsulting.NuGetInstaller.csproj Bumps caching dependency to 1.4.0 to support enhanced config handling.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/DemaConsulting.NuGetInstaller/Program.cs
…g discovery

Addresses PR #38 reviewer feedback requesting test coverage for the
configRoot derivation added to Program.RunToolLogic. Adds an end-to-end
test that builds an isolated temp repo layout (nuget.config at the root
defining a local-folder package source, packages.config nested in a
subdirectory) and verifies Program.Run resolves and installs the package
using only the repo-local config, plus a negative test confirming
resolution fails without that config present.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings July 10, 2026 22:12

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated no new comments.

@Malcolmnixon
Malcolmnixon merged commit 229389b into main Jul 10, 2026
16 checks passed
@Malcolmnixon
Malcolmnixon deleted the fix/issue-37-nuget-config-discovery branch July 10, 2026 22:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants