Skip to content

Fix default publish output path for TypeScript AppHosts#16157

Merged
sebastienros merged 7 commits intomainfrom
sebastienros/sebros-fix-ts-publish-path
Apr 15, 2026
Merged

Fix default publish output path for TypeScript AppHosts#16157
sebastienros merged 7 commits intomainfrom
sebastienros/sebros-fix-ts-publish-path

Conversation

@sebastienros
Copy link
Copy Markdown
Contributor

Description

aspire publish for TypeScript/polyglot AppHosts was defaulting output under ~/.aspire/bundle-hosts/... because the prebuilt remote host runs from that helper directory and PipelineOutputService fell back to the process current directory.

This change makes the default pipeline output path use the resolved AppHost directory from AppHost:Directory instead. That keeps publish output under the real workspace while preserving the helper server's bundle-host working directory for generated files and restore artifacts.

It also adds a hosting regression test for the default output path and a TypeScript publish regression test. The E2E test is gated to current CLI bits so it does not fail when run locally against the GA-installed CLI.

Fixes #15448

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?

Prefer the resolved AppHost directory over the helper server working directory when pipeline output path is not specified. This keeps TypeScript AppHost publish output under the workspace instead of ~/.aspire/bundle-hosts, adds a hosting regression test, and adds a TypeScript publish regression test gated to current CLI bits.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings April 14, 2026 16:07
Copy link
Copy Markdown
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

Note

Copilot was unable to run its full agentic suite in this review.

Fixes aspire publish default output location for TypeScript/polyglot AppHosts by using the resolved AppHost directory instead of the helper host process working directory, and adds regressions to prevent backsliding.

Changes:

  • Update PipelineOutputService to default output under AppHost:Directory/aspire-output (falling back to Environment.CurrentDirectory).
  • Add a hosting unit test validating the new default output path behavior.
  • Add an E2E TypeScript publish regression test verifying docker-compose.yaml lands in the default output directory.

Reviewed changes

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

File Description
tests/Aspire.Hosting.Tests/DistributedApplicationBuilderTests.cs Adds unit coverage ensuring pipeline output defaults to the AppHost directory.
tests/Aspire.Cli.EndToEnd.Tests/TypeScriptPublishTests.cs Adds an E2E regression test for TypeScript publish default output placement.
src/Aspire.Hosting/Pipelines/PipelineOutputService.cs Changes default output path resolution to use AppHost:Directory from configuration.

Comment thread src/Aspire.Hosting/Pipelines/PipelineOutputService.cs Outdated
Comment thread src/Aspire.Hosting/Pipelines/PipelineOutputService.cs Outdated
sebastienros and others added 2 commits April 14, 2026 09:19
Update the pipeline output service contract and publish help text to match the new AppHost-relative default output location.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Avoid resolving the AppHost directory when an explicit output path is already configured, fall back cleanly when AppHost directory canonicalization fails, clarify the AppHost directory wording, and include the generated XLF updates from the publish help text change.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 14, 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/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.sh | bash -s -- 16157

Or

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

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Comment thread src/Aspire.Hosting/Pipelines/PipelineOutputService.cs Outdated
Copy link
Copy Markdown
Member

@radical radical left a comment

Choose a reason for hiding this comment

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

1 finding: test coverage gap for error-handling fallback path.

Comment thread tests/Aspire.Hosting.Tests/DistributedApplicationBuilderTests.cs
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
}
}

return Path.Combine(baseDirectory, "aspire-output");
Copy link
Copy Markdown
Contributor

@davidfowl davidfowl Apr 15, 2026

Choose a reason for hiding this comment

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

Suggested change
return Path.Combine(baseDirectory, "aspire-output");
return Path.GetFullPath(baseDirectory, "aspire-output");

@github-actions
Copy link
Copy Markdown
Contributor

🎬 CLI E2E Test Recordings — 70 recordings uploaded (commit 67653bb)

View recordings
Test Recording
AddPackageInteractiveWhileAppHostRunningDetached ▶️ View Recording
AddPackageWhileAppHostRunningDetached ▶️ View Recording
AgentCommands_AllHelpOutputs_AreCorrect ▶️ View Recording
AgentInitCommand_DefaultSelection_InstallsSkillOnly ▶️ View Recording
AgentInitCommand_MigratesDeprecatedConfig ▶️ View Recording
AspireAddPackageVersionToDirectoryPackagesProps ▶️ View Recording
AspireUpdateRemovesAppHostPackageVersionFromDirectoryPackagesProps ▶️ View Recording
Banner_DisplayedOnFirstRun ▶️ View Recording
Banner_DisplayedWithExplicitFlag ▶️ View Recording
Banner_NotDisplayedWithNoLogoFlag ▶️ View Recording
CertificatesClean_RemovesCertificates ▶️ View Recording
CertificatesTrust_WithNoCert_CreatesAndTrustsCertificate ▶️ View Recording
CertificatesTrust_WithUntrustedCert_TrustsCertificate ▶️ View Recording
ConfigSetGet_CreatesNestedJsonFormat ▶️ View Recording
CreateAndRunAspireStarterProject ▶️ View Recording
CreateAndRunAspireStarterProjectWithBundle ▶️ View Recording
CreateAndRunEmptyAppHostProject ▶️ View Recording
CreateAndRunJavaEmptyAppHostProject ▶️ View Recording
CreateAndRunJsReactProject ▶️ View Recording
CreateAndRunPythonReactProject ▶️ View Recording
CreateAndRunTypeScriptEmptyAppHostProject ▶️ View Recording
CreateAndRunTypeScriptStarterProject ▶️ View Recording
CreateJavaAppHostWithViteApp ▶️ View Recording
CreateTypeScriptAppHostWithViteApp ▶️ View Recording
DashboardRunWithOtelTracesReturnsNoTraces ▶️ View Recording
DeployK8sBasicApiService ▶️ View Recording
DeployK8sWithGarnet ▶️ View Recording
DeployK8sWithMongoDB ▶️ View Recording
DeployK8sWithMySql ▶️ View Recording
DeployK8sWithPostgres ▶️ View Recording
DeployK8sWithRabbitMQ ▶️ View Recording
DeployK8sWithRedis ▶️ View Recording
DeployK8sWithSqlServer ▶️ View Recording
DeployK8sWithValkey ▶️ View Recording
DeployTypeScriptAppToKubernetes ▶️ View Recording
DescribeCommandResolvesReplicaNames ▶️ View Recording
DescribeCommandShowsRunningResources ▶️ View Recording
DetachFormatJsonProducesValidJson ▶️ View Recording
DoListStepsShowsPipelineSteps ▶️ View Recording
DoctorCommand_DetectsDeprecatedAgentConfig ▶️ View Recording
DoctorCommand_WithSslCertDir_ShowsTrusted ▶️ View Recording
DoctorCommand_WithoutSslCertDir_ShowsPartiallyTrusted ▶️ View Recording
GlobalMigration_HandlesCommentsAndTrailingCommas ▶️ View Recording
GlobalMigration_HandlesMalformedLegacyJson ▶️ View Recording
GlobalMigration_PreservesAllValueTypes ▶️ View Recording
GlobalMigration_SkipsWhenNewConfigExists ▶️ View Recording
GlobalSettings_MigratedFromLegacyFormat ▶️ View Recording
InitTypeScriptAppHost_AugmentsExistingViteRepoAtRoot ▶️ View Recording
InvalidAppHostPathWithComments_IsHealedOnRun ▶️ View Recording
LegacySettingsMigration_AdjustsRelativeAppHostPath ▶️ View Recording
LogsCommandShowsResourceLogs ▶️ View Recording
OtelLogsReturnsStructuredLogsFromStarterApp ▶️ View Recording
PsCommandListsRunningAppHost ▶️ View Recording
PsFormatJsonOutputsOnlyJsonToStdout ▶️ View Recording
PublishWithConfigureEnvFileUpdatesEnvOutput ▶️ View Recording
PublishWithDockerComposeServiceCallbackSucceeds ▶️ View Recording
PublishWithoutOutputPathUsesAppHostDirectoryDefault ▶️ View Recording
RestoreGeneratesSdkFiles ▶️ View Recording
RestoreSupportsConfigOnlyHelperPackageAndCrossPackageTypes ▶️ View Recording
RunFromParentDirectory_UsesExistingConfigNearAppHost ▶️ View Recording
SecretCrudOnDotNetAppHost ▶️ View Recording
SecretCrudOnTypeScriptAppHost ▶️ View Recording
StagingChannel_ConfigureAndVerifySettings_ThenSwitchChannels ▶️ View Recording
StartAndWaitForTypeScriptSqlServerAppHostWithNativeAssets ▶️ View Recording
StopAllAppHostsFromAppHostDirectory ▶️ View Recording
StopAllAppHostsFromUnrelatedDirectory ▶️ View Recording
StopNonInteractiveMultipleAppHostsShowsError ▶️ View Recording
StopNonInteractiveSingleAppHost ▶️ View Recording
StopWithNoRunningAppHostExitsSuccessfully ▶️ View Recording
UnAwaitedChainsCompileWithAutoResolvePromises ▶️ View Recording

📹 Recordings uploaded automatically from CI run #24438038058

@sebastienros sebastienros merged commit b3a8141 into main Apr 15, 2026
278 checks passed
@sebastienros sebastienros deleted the sebastienros/sebros-fix-ts-publish-path branch April 15, 2026 14:14
@github-actions github-actions bot added this to the 13.3 milestone Apr 15, 2026
aspire-repo-bot bot added a commit to microsoft/aspire.dev that referenced this pull request Apr 15, 2026
…ctory

The default output path for aspire publish is relative to the AppHost
directory, not the current working directory. Update the documentation
to match the clarified CLI help text from microsoft/aspire#16157.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@aspire-repo-bot
Copy link
Copy Markdown
Contributor

Pull request created: #716

Generated by PR Documentation Check

@aspire-repo-bot
Copy link
Copy Markdown
Contributor

A documentation draft PR has been opened on microsoft/aspire.dev to align the aspire publish command reference with the behavior fixed in this PR.

What was updated: The description for the --output-path option now says "Defaults to the AppHost directory's aspire-output folder if not specified" instead of "Defaults to ./aspire-output if not specified" — matching the clarified CLI help text introduced here.

The draft PR needs human review before merging.

Generated by PR Documentation Check for issue #16157 · ● 544.4K ·

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.

apphost.ts aspire publish goes to ~/.aspire/bundle-hosts

4 participants