Handle polyglot settings package versions on read path#14446
Handle polyglot settings package versions on read path#14446sebastienros merged 7 commits intorelease/13.2from
Conversation
|
🚀 Dogfood this PR with:
curl -fsSL https://raw.githubusercontent.com/dotnet/aspire/main/eng/scripts/get-aspire-cli-pr.sh | bash -s -- 14446Or
iex "& { $(irm https://raw.githubusercontent.com/dotnet/aspire/main/eng/scripts/get-aspire-cli-pr.ps1) } 14446" |
There was a problem hiding this comment.
Pull request overview
Updates Aspire CLI’s polyglot settings read-path so .aspire/settings.json can omit channel/sdkVersion and use empty package versions, while also centralizing “Aspire repo checkout” detection for dev/project-reference scenarios.
Changes:
- Added
AspireRepositoryDetectorand wired it into CLI/project flows (AppHost server selection + add/update command logic). - Added read-time helpers in
AspireJsonConfigurationto resolve an effective SDK version and to treat empty package versions as “use SDK version”. - Updated guest AppHost/scaffolding flows and playground polyglot settings to rely on read-time version resolution.
Reviewed changes
Copilot reviewed 12 out of 13 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/Aspire.Cli.Tests/Utils/AspireRepositoryDetectorTests.cs | Adds coverage for repo-root detection precedence (solution search vs env var). |
| tests/Aspire.Cli.Tests/Projects/GuestAppHostProjectTests.cs | Adds tests for GetAllPackages overload behavior with fallback SDK version / empty package versions. |
| src/Aspire.Cli/Utils/AspireRepositoryDetector.cs | New shared repo-root detection (Aspire.slnx → env var → process path). |
| src/Aspire.Cli/Scaffolding/ScaffoldingService.cs | Uses effective SDK/package resolution at scaffold-time. |
| src/Aspire.Cli/Projects/ProjectLocator.cs | Whitespace-only change. |
| src/Aspire.Cli/Projects/GuestAppHostProject.cs | Uses read-time SDK/package resolution consistently for guest apphost flows. |
| src/Aspire.Cli/Projects/AppHostServerProject.cs | Switches dev-mode detection to use the new shared repo detector. |
| src/Aspire.Cli/Configuration/AspireJsonConfiguration.cs | Adds effective SDK/package resolution helpers; supports empty package versions. |
| src/Aspire.Cli/Commands/UpdateCommand.cs | Adjusts channel selection logic for guest projects in repo/project-reference mode. |
| src/Aspire.Cli/Commands/AddCommand.cs | Avoids reading polyglot “channel” from settings when in repo/project-reference mode. |
| playground/polyglot/TypeScript/**/.aspire/settings.json | Removes channel/sdkVersion and sets package versions to empty strings. |
🎬 CLI E2E Test RecordingsThe following terminal recordings are available for commit
📹 Recordings uploaded automatically from CI run #21994375048 |
davidfowl
left a comment
There was a problem hiding this comment.
My only concern https://github.com/dotnet/aspire/pull/14446/changes#r2799921599
We should be doing this lookup once per invocation and this logic should not be in dev builds only so we're not slowing down the primary path.
Summary
settings.jsonfiles to removechannel/sdkVersionand use empty package versions.csprojempty-version handling)AspireRepositoryDetector(Aspire.slnxfirst, thenASPIRE_REPO_ROOT, then process-path fallback)Details
AspireRepositoryDetectorand used it fromAppHostServerProject,AddCommand, andUpdateCommand.AspireJsonConfiguration:GetEffectiveSdkVersion(defaultSdkVersion)GetAllPackages(defaultSdkVersion, useProjectReferences)GuestAppHostProjectandScaffoldingServiceto use read-time package resolution.Tests
dotnet test tests/Aspire.Cli.Tests/Aspire.Cli.Tests.csproj -- --filter-class "*.GuestAppHostProjectTests" --filter-class "*.AppHostServerProjectTests" --filter-class "*.AspireRepositoryDetectorTests" --filter-class "*.ProjectLocatorTests" --filter-class "*.UpdateCommandTests" --filter-not-trait "quarantined=true" --filter-not-trait "outerloop=true"