Exclude NuGet cache from project file search in ProjectLocator#15388
Open
MO2k4 wants to merge 2 commits intomicrosoft:mainfrom
Open
Exclude NuGet cache from project file search in ProjectLocator#15388MO2k4 wants to merge 2 commits intomicrosoft:mainfrom
MO2k4 wants to merge 2 commits intomicrosoft:mainfrom
Conversation
When running `aspire update` from a broad directory (e.g. home), the ProjectLocator would descend into ~/.nuget/packages and incorrectly surface immutable template packages as updatable AppHost projects. Replace Directory.GetFiles with FileSystemEnumerable to skip the NuGet cache directory via ShouldRecursePredicate. The cache path is resolved from NUGET_PACKAGES env var or the platform default. Adds three tests covering cache exclusion, normal discovery, and custom cache paths. Fixes microsoft#14055
Contributor
|
🚀 Dogfood this PR with:
curl -fsSL https://raw.githubusercontent.com/dotnet/aspire/main/eng/scripts/get-aspire-cli-pr.sh | bash -s -- 15388Or
iex "& { $(irm https://raw.githubusercontent.com/dotnet/aspire/main/eng/scripts/get-aspire-cli-pr.ps1) } 15388" |
davidfowl
reviewed
Mar 19, 2026
| } | ||
|
|
||
| [Fact] | ||
| public async Task FindAppHostProjectFilesAsync_RespectsCustomNuGetPackagesEnvVar() |
Contributor
There was a problem hiding this comment.
Tests shouldn't set env variables like this, it affects the ability to run concurrently and can impact other tests.
Author
There was a problem hiding this comment.
Thanks for the feedback, i've adjusted this and now switched to CliExecutionContext
…liExecutionContext
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.
Summary
aspire updateincorrectly surfacing immutable NuGet template packages (e.g.aspire.projecttemplates) as updatable AppHost projects when run from a broad directory like~Directory.GetFileswithFileSystemEnumerableusingShouldRecursePredicateto skip the NuGet cache directory before descending into itNUGET_PACKAGESenv var or the platform-appropriate default (~/.nuget/packages)Fixes #14055
Test plan
FindAppHostProjectFilesAsync_ExcludesProjectsInsideNuGetCache— verifies projects inside the NuGet cache are excludedFindAppHostProjectFilesAsync_FindsProjectsOutsideNuGetCache— verifies normal project discovery still worksFindAppHostProjectFilesAsync_RespectsCustomNuGetPackagesEnvVar— verifies customNUGET_PACKAGESpaths are honored