Skip to content

Handle polyglot settings package versions on read path#14446

Merged
sebastienros merged 7 commits intorelease/13.2from
sebros/polyglot-packref
Feb 13, 2026
Merged

Handle polyglot settings package versions on read path#14446
sebastienros merged 7 commits intorelease/13.2from
sebros/polyglot-packref

Conversation

@sebastienros
Copy link
Member

Summary

  • update playground polyglot settings.json files to remove channel/sdkVersion and use empty package versions
  • treat empty versions as a read-path concern only for polyglot settings (no .csproj empty-version handling)
  • introduce shared repo detection in AspireRepositoryDetector (Aspire.slnx first, then ASPIRE_REPO_ROOT, then process-path fallback)
  • apply repo/project-reference detection logic in polyglot-related CLI command paths
  • resolve effective package versions at read-time for guest apphost/scaffolding flows

Details

  • Added AspireRepositoryDetector and used it from AppHostServerProject, AddCommand, and UpdateCommand.
  • Added read-path helpers in AspireJsonConfiguration:
    • GetEffectiveSdkVersion(defaultSdkVersion)
    • GetAllPackages(defaultSdkVersion, useProjectReferences)
  • Updated GuestAppHostProject and ScaffoldingService to use read-time package resolution.
  • Kept write behavior unchanged so Aspire developers can manually edit/remove properties in repo scenarios.

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"

Copilot AI review requested due to automatic review settings February 11, 2026 16:44
@github-actions
Copy link
Contributor

github-actions bot commented Feb 11, 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/dotnet/aspire/main/eng/scripts/get-aspire-cli-pr.sh | bash -s -- 14446

Or

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

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 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 AspireRepositoryDetector and wired it into CLI/project flows (AppHost server selection + add/update command logic).
  • Added read-time helpers in AspireJsonConfiguration to 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.

@github-actions
Copy link
Contributor

github-actions bot commented Feb 11, 2026

🎬 CLI E2E Test Recordings

The following terminal recordings are available for commit 0be9836:

Test Recording
AgentCommands_AllHelpOutputs_AreCorrect ▶️ View Recording
AgentInitCommand_MigratesDeprecatedConfig ▶️ View Recording
Banner_DisplayedOnFirstRun ▶️ View Recording
Banner_DisplayedWithExplicitFlag ▶️ View Recording
CreateAndDeployToDockerCompose ▶️ View Recording
CreateAndDeployToDockerComposeInteractive ▶️ View Recording
CreateAndPublishToKubernetes ▶️ View Recording
CreateAndRunAspireStarterProject ▶️ View Recording
CreateAndRunAspireStarterProjectWithBundle ▶️ View Recording
CreateAndRunJsReactProject ▶️ View Recording
CreateAndRunPythonReactProject ▶️ View Recording
CreateEmptyAppHostProject ▶️ View Recording
CreateStartAndStopAspireProject ▶️ View Recording
CreateStartWaitAndStopAspireProject ▶️ View Recording
CreateTypeScriptAppHostWithViteApp ▶️ View Recording
DoctorCommand_DetectsDeprecatedAgentConfig ▶️ View Recording
DoctorCommand_WithSslCertDir_ShowsTrusted ▶️ View Recording
DoctorCommand_WithoutSslCertDir_ShowsPartiallyTrusted ▶️ View Recording
LogsCommandShowsResourceLogs ▶️ View Recording
PsCommandListsRunningAppHost ▶️ View Recording
ResourcesCommandShowsRunningResources ▶️ View Recording

📹 Recordings uploaded automatically from CI run #21994375048

@sebastienros sebastienros changed the base branch from main to release/13.2 February 11, 2026 17:39
Copy link
Member

@davidfowl davidfowl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@sebastienros sebastienros enabled auto-merge (squash) February 13, 2026 15:10
@sebastienros sebastienros merged commit 27eaa9d into release/13.2 Feb 13, 2026
342 checks passed
@sebastienros sebastienros deleted the sebros/polyglot-packref branch February 13, 2026 16:50
@dotnet-policy-service dotnet-policy-service bot added this to the 13.2 milestone Feb 13, 2026
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.

3 participants