Bump DemaConsulting.NuGet.Caching to 1.4.0 and enhance config handling#38
Merged
Merged
Conversation
…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>
Contributor
There was a problem hiding this comment.
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 containingpackages.config) inProgram.RunToolLogicand pass it into installation. - Extend
PackageInstaller.InstallAsync/InstallPackageAsyncto accept and forward an optionalconfigRootintoNuGetCache.EnsureCachedAsync. - Update
DemaConsulting.NuGet.Cachingfrom1.3.0to1.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.
…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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request updates the NuGet package caching logic to better support project- or repository-local
nuget.configfiles, aligning the package discovery process with howdotnet restoreworks. The main changes involve passing the directory containingpackages.configas a root fornuget.configdiscovery, and updating dependencies.NuGet config discovery improvements:
InstallAsyncandInstallPackageAsyncmethods inPackageInstallernow accept an optionalconfigRootparameter, which is used to locate a localnuget.configfile, matching the behavior ofdotnet restore. [1] [2]RunToolLogicmethod inProgram.csnow determines the directory containingpackages.configand passes it asconfigRoottoInstallAsync, ensuring localnuget.configfiles are discovered and used.NuGetCache.EnsureCachedAsyncis updated to receive theconfigRootparameter, improving cache resolution for local configurations.Dependency updates:
DemaConsulting.NuGet.Cachingpackage reference is updated from version 1.3.0 to 1.4.0 inDemaConsulting.NuGetInstaller.csproj.