Skip to content

Fix default NuGet packages restore folder#15416

Open
eerhardt wants to merge 2 commits intomicrosoft:mainfrom
eerhardt:FixNuGetRestorePackagesMain
Open

Fix default NuGet packages restore folder#15416
eerhardt wants to merge 2 commits intomicrosoft:mainfrom
eerhardt:FixNuGetRestorePackagesMain

Conversation

@eerhardt
Copy link
Member

@eerhardt eerhardt commented Mar 20, 2026

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
Copy link
Contributor

github-actions bot commented Mar 20, 2026

🚀 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
Member Author

/backport to release/13.2

@github-actions
Copy link
Contributor

Started backporting to release/13.2: https://github.com/dotnet/aspire/actions/runs/23323572778

Copy link
Contributor

Copilot AI left a comment

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
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.

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

Fix microsoft#15399
Fix microsoft#15404
@eerhardt eerhardt force-pushed the FixNuGetRestorePackagesMain branch from 1ccd6b7 to 6c9c83a Compare March 20, 2026 21:40
Simplify the code to use the same patterns as NuGet.Client sources.
@eerhardt eerhardt requested a review from JamesNK March 20, 2026 22:57
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.

Polyglot AppHost doesn't respect $env:NUGET_PACKAGES

2 participants