Skip to content

Make .NET SDK check in aspire doctor based on apphost language#15018

Open
davidfowl wants to merge 2 commits intorelease/13.2from
davidfowl/doctor-polyglot-dotnet-check
Open

Make .NET SDK check in aspire doctor based on apphost language#15018
davidfowl wants to merge 2 commits intorelease/13.2from
davidfowl/doctor-polyglot-dotnet-check

Conversation

@davidfowl
Copy link
Member

Description

Make the .NET SDK check in aspire doctor aware of the AppHost language. When the detected AppHost is a non-.NET project (TypeScript, Python, Go, etc.), the .NET SDK check is skipped since it's not required for polyglot scenarios.

Uses the same IProjectLocator pattern as aspire run to find the AppHost, then checks its language via ILanguageDiscovery.GetLanguageByFile(). Falls through to the normal .NET SDK check when no AppHost is found, multiple are found, or the AppHost is a .NET project.

Fixes #14404

Checklist

  • Is this feature complete?
    • Yes. Ready to ship.
    • No. Follow-up changes expected.
  • Are you including unit tests for the changes and scenario tests if relevant?
    • Yes
    • No
  • Did you add public API?
    • Yes
      • If yes, did you have an API Review for it?
        • Yes
        • No
      • Did you add <remarks /> and <code /> elements on your triple slash comments?
        • Yes
        • No
    • No
  • Does the change make any security assumptions or guarantees?
    • Yes
      • If yes, have you done a threat model and had a security review?
        • Yes
        • No
    • No
  • Does the change require an update in our Aspire docs?

Copilot AI review requested due to automatic review settings March 6, 2026 19:06
@github-actions
Copy link
Contributor

github-actions bot commented Mar 6, 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 -- 15018

Or

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

@davidfowl davidfowl force-pushed the davidfowl/doctor-polyglot-dotnet-check branch from da619c1 to 38004f0 Compare March 6, 2026 19:11
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 doctor’s .NET SDK prerequisite check to be language-aware by attempting to locate the AppHost and skipping the SDK check when the AppHost is identified as non-.NET (polyglot) to avoid false failures in those scenarios.

Changes:

  • Extend DotNetSdkCheck to use IProjectLocator + ILanguageDiscovery to detect a non-.NET AppHost and skip the SDK check.
  • Add unit tests covering “no apphost”, “non-.NET apphost”, “.NET apphost”, “multiple apphosts”, and “unknown language” behaviors.

Reviewed changes

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

File Description
src/Aspire.Cli/Utils/EnvironmentChecker/DotNetSdkCheck.cs Adds AppHost discovery + language detection to decide whether to skip the .NET SDK check for polyglot scenarios.
tests/Aspire.Cli.Tests/Commands/DotNetSdkCheckTests.cs Introduces unit coverage for the new skip/fallthrough behaviors.

Update DotNetSdkCheck to detect the apphost project (same pattern as
aspire run) and skip the .NET SDK check when the apphost is a non-.NET
project (TypeScript, Python, Go, etc.).

Fixes #14404

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@davidfowl davidfowl force-pushed the davidfowl/doctor-polyglot-dotnet-check branch from 38004f0 to c37813f Compare March 6, 2026 19:31
@github-actions
Copy link
Contributor

github-actions bot commented Mar 6, 2026

🎬 CLI E2E Test Recordings

The following terminal recordings are available for commit bce7f42:

Test Recording
AddPackageInteractiveWhileAppHostRunningDetached ▶️ View Recording
AddPackageWhileAppHostRunningDetached ▶️ View Recording
AgentCommands_AllHelpOutputs_AreCorrect ▶️ View Recording
AgentInitCommand_DefaultSelection_InstallsSkillOnly ▶️ View Recording
AgentInitCommand_MigratesDeprecatedConfig ▶️ View Recording
AspireUpdateRemovesAppHostPackageVersionFromDirectoryPackagesProps ▶️ 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
CreateAndRunTypeScriptStarterProject ▶️ View Recording
CreateEmptyAppHostProject ▶️ View Recording
CreateStartAndStopAspireProject ▶️ View Recording
CreateStartWaitAndStopAspireProject ▶️ View Recording
CreateTypeScriptAppHostWithViteApp ▶️ View Recording
DescribeCommandResolvesReplicaNames ▶️ View Recording
DescribeCommandShowsRunningResources ▶️ View Recording
DetachFormatJsonProducesValidJson ▶️ View Recording
DoctorCommand_DetectsDeprecatedAgentConfig ▶️ View Recording
DoctorCommand_WithSslCertDir_ShowsTrusted ▶️ View Recording
DoctorCommand_WithoutSslCertDir_ShowsPartiallyTrusted ▶️ View Recording
LogsCommandShowsResourceLogs ▶️ View Recording
PsCommandListsRunningAppHost ▶️ View Recording
PsFormatJsonOutputsOnlyJsonToStdout ▶️ View Recording
SecretCrudOnDotNetAppHost ▶️ View Recording
SecretCrudOnTypeScriptAppHost ▶️ View Recording
StagingChannel_ConfigureAndVerifySettings_ThenSwitchChannels ▶️ View Recording
StopAllAppHostsFromAppHostDirectory ▶️ View Recording
StopAllAppHostsFromUnrelatedDirectory ▶️ View Recording
StopNonInteractiveMultipleAppHostsShowsError ❌ Upload failed
StopNonInteractiveSingleAppHost ▶️ View Recording
StopWithNoRunningAppHostExitsSuccessfully ▶️ View Recording
TypeScriptAppHostWithProjectReferenceIntegration ▶️ View Recording

📹 Recordings uploaded automatically from CI run #22780517245

Skip the .NET SDK check entirely when no settings.json is found or when
the apphost is non-.NET. Previously the check would fall through and run
whenever we couldn't determine the language.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
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.

2 participants