Skip to content

Fix default NuGet packages restore folder - #15416

Merged
Eric Erhardt (eerhardt) merged 5 commits into
microsoft:mainfrom
eerhardt:FixNuGetRestorePackagesMain
Apr 1, 2026
Merged

Eric Erhardt (eerhardt) merged 5 commits into
microsoft:mainfrom
eerhardt:FixNuGetRestorePackagesMain

Conversation

@eerhardt

@eerhardt Eric Erhardt (eerhardt) commented Mar 20, 2026 •

Copy link
Copy Markdown
Member

We shouldn't default to ~/.nuget/packages. Instead we should use NuGet defaulting logic.

Refactor the restore code using the patterns from the NuGet.Client sources. This simplifies the code.

Fix #15404

Copilot AI review requested due to automatic review settings March 20, 2026 00:28
@github-actions

github-actions Bot commented Mar 20, 2026 •

Copy link
Copy Markdown
Contributor

🚀 Dogfood this PR with:

⚠️ WARNING: Do not do this without first carefully reviewing the code of this PR to satisfy yourself it is safe.

curl -fsSL https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.sh | bash -s -- 15416

Or

  • Run remotely in PowerShell:
iex "& { $(irm https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.ps1) } 15416"

@eerhardt

Copy link
Copy Markdown
Member Author

/backport to release/13.2

@github-actions

Copy link
Copy Markdown
Contributor

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

Updates RestoreCommand to use NuGet’s built-in settings resolution for the global packages folder instead of hard-coding ~/.nuget/packages, aligning behavior with NuGet defaults and config.

Changes:

  • Replace hard-coded user-profile-based packages folder with NuGet settings-based resolution.
  • Load NuGet configuration settings and compute the global packages folder via SettingsUtility.

@github-actions

Copy link
Copy Markdown
Contributor

Re-running the failed jobs in the CI workflow for this pull request because 3 jobs were identified as retry-safe transient failures in the CI run attempt.
GitHub was asked to rerun all failed jobs for that attempt, and the rerun is being tracked in the rerun attempt.
The job links below point to the failed attempt jobs that matched the retry-safe transient failure rules.

  • Tests / Npgsql / Npgsql (ubuntu-latest) - Failed step 'Build test project' will be retried because the job log shows a likely transient infrastructure network failure. Matched pattern: /Unable to load the service index for source https:\/\/(?:pkgs\.dev\.azure\.com\/dnceng|dnceng\.pkgs\.visualstudio\.com)\/public\/_packaging\//i.
  • Tests / Microsoft.EntityFrameworkCore.Cosmos / Microsoft.EntityFrameworkCore.Cosmos (ubuntu-latest) - Failed step 'Build test project' will be retried because the job log shows a likely transient infrastructure network failure. Matched pattern: /Unable to load the service index for source https:\/\/(?:pkgs\.dev\.azure\.com\/dnceng|dnceng\.pkgs\.visualstudio\.com)\/public\/_packaging\//i.
  • Tests / Dashboard / Dashboard (ubuntu-latest) - Failed step 'Build test project' will be retried because the job log shows a likely transient infrastructure network failure. Matched pattern: /Unable to load the service index for source https:\/\/(?:pkgs\.dev\.azure\.com\/dnceng|dnceng\.pkgs\.visualstudio\.com)\/public\/_packaging\//i.

@joperezr

Copy link
Copy Markdown
Member

Left some minor feedback but this looks good otherwise.

We shouldn't default to ~/.nuget/packages. Instead we should use NuGet defaulting logic.

Fix microsoft#15399
Fix microsoft#15404
Simplify the code to use the same patterns as NuGet.Client sources.
@eerhardt
Eric Erhardt (eerhardt) force-pushed the FixNuGetRestorePackagesMain branch from 4babf7d to 18d72a0 Compare March 31, 2026 19:26
@eerhardt
Eric Erhardt (eerhardt) enabled auto-merge (squash) March 31, 2026 19:30
@eerhardt
Eric Erhardt (eerhardt) merged commit f877827 into microsoft:main Apr 1, 2026
258 checks passed
@aspire-repo-bot

Copy link
Copy Markdown
Contributor

No documentation PR is required for this change.

Reason: This PR is a bug fix (#15404) that refactors the internal NuGet restore logic in Aspire.Managed to use NuGet's default package folder resolution instead of hardcoding ~/.nuget/packages. The changes are entirely internal (no public API surface, no new configuration options, no user-facing behavioral changes), so existing documentation already covers the relevant behavior adequately.

Generated by PR Documentation Check · ● 146K · ◷

@github-actions github-actions Bot locked and limited conversation to collaborators Jun 5, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Polyglot AppHost doesn't respect $env:NUGET_PACKAGES

4 participants