Skip to content

Fix globalPackagesFolder path to be platform-agnostic in NuGetConfigMerger#11624

Merged
davidfowl merged 2 commits intomainfrom
copilot/fix-40d73c88-ed8b-4c1a-9cc3-8c4270d4c948
Sep 24, 2025
Merged

Fix globalPackagesFolder path to be platform-agnostic in NuGetConfigMerger#11624
davidfowl merged 2 commits intomainfrom
copilot/fix-40d73c88-ed8b-4c1a-9cc3-8c4270d4c948

Conversation

Copy link
Contributor

Copilot AI commented Sep 24, 2025

Problem

When the PackageChannel has ConfigureGlobalPackagesFolder set to true, the NuGetConfigMerger sets the globalPackagesFolder config value in the nuget.config to .nuget\packages. This causes package restore to fail on Linux systems because the backslash path separator is Windows-specific.

Solution

Changed the globalPackagesFolder value from .nuget\packages to .nugetpackages (removed the slash entirely). This approach:

  • Avoids platform-specific path separator issues
  • Works consistently across Windows, Linux, and macOS
  • Allows the nuget.config file to be safely checked into source control
  • Maintains the same package isolation functionality

Changes

  • src/Aspire.Cli/Packaging/NuGetConfigMerger.cs: Updated AddGlobalPackagesFolderConfiguration method to use .nugetpackages instead of .nuget\\packages
  • tests/Aspire.Cli.Tests/Packaging/PackagingServiceTests.cs: Updated test expectations to validate the new path value

Testing

The existing test NuGetConfigMerger_WhenChannelRequiresGlobalPackagesFolder_AddsGlobalPackagesFolderConfiguration has been updated and continues to pass, ensuring the XML structure is correct and the globalPackagesFolder value is properly set to .nugetpackages.

This change only affects staging channels where ConfigureGlobalPackagesFolder is enabled and resolves the Linux package restore issue without impacting other functionality.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Co-authored-by: mitchdenny <513398+mitchdenny@users.noreply.github.com>
@github-actions
Copy link
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/dotnet/aspire/main/eng/scripts/get-aspire-cli-pr.sh | bash -s -- 11624

Or

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

@mitchdenny mitchdenny marked this pull request as ready for review September 24, 2025 03:23
Copilot AI review requested due to automatic review settings September 24, 2025 03:23
Copilot AI changed the title [WIP] In NuGetConfigMerger, when the PackageChannel has the ConfigureGlobalPackagesFolder to true we set the globalPackagesFolder config value in the nuget.config folder to .nuget\packages. however this causes a problem on Linux systems because it stops pack... Fix globalPackagesFolder path to be platform-agnostic in NuGetConfigMerger Sep 24, 2025
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

This PR fixes a platform-specific issue where the NuGet global packages folder path was causing package restore failures on Linux systems due to Windows-specific backslash path separators.

  • Changes the globalPackagesFolder value from .nuget\packages to .nugetpackages to eliminate path separator issues
  • Updates the corresponding test to expect the new path value
  • Ensures cross-platform compatibility while maintaining the same package isolation functionality

Reviewed Changes

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

File Description
src/Aspire.Cli/Packaging/NuGetConfigMerger.cs Updated globalPackagesFolder value from .nuget\packages to .nugetpackages
tests/Aspire.Cli.Tests/Packaging/PackagingServiceTests.cs Updated test assertions to expect the new .nugetpackages path value

Copilot AI requested a review from mitchdenny September 24, 2025 03:23
@mitchdenny mitchdenny requested review from davidfowl and joperezr and removed request for mitchdenny September 24, 2025 03:23
@davidfowl davidfowl merged commit 760a147 into main Sep 24, 2025
311 checks passed
@davidfowl davidfowl deleted the copilot/fix-40d73c88-ed8b-4c1a-9cc3-8c4270d4c948 branch September 24, 2025 04:39
@mitchdenny
Copy link
Member

/backport to release/9.5

@dotnet-policy-service dotnet-policy-service bot added this to the 9.6 milestone Sep 24, 2025
@github-actions
Copy link
Contributor

Started backporting to release/9.5: https://github.com/dotnet/aspire/actions/runs/17966499657

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.

4 participants