Skip to content

Fix staging Aspire CLI install command for polyglot apphost.ts support#1496

Open
Copilot wants to merge 23 commits intomainfrom
copilot/update-samples-for-aspire-cli
Open

Fix staging Aspire CLI install command for polyglot apphost.ts support#1496
Copilot wants to merge 23 commits intomainfrom
copilot/update-samples-for-aspire-cli

Conversation

Copy link
Contributor

Copilot AI commented Mar 3, 2026

Bifurcate samples into cs/ and ts/ AppHost subdirectories

Summary

Restructures all 14 AppHost samples to isolate the C# and TypeScript polyglot AppHosts into separate cs/ and ts/ subdirectories. This enables each AppHost to be tested and run independently via aspire run from its respective language folder.

What changed

  • Directory structure: Each sample's AppHost is now split into cs/ (C# AppHost) and ts/ (TypeScript AppHost) subdirectories. Shared service projects remain at the sample root.
  • TypeScript AppHosts: All ts/ directories were scaffolded using aspire new aspire-empty --language TypeScript, then aspire add {integration} was run for each required package. Each apphost.ts is customized to match its C# counterpart.
  • C# AppHosts: Moved into cs/ with updated ProjectReference paths (../../../) and updated bind mount / Dockerfile context paths.
  • Solution files: All .slnx files updated to reference the new cs/ AppHost paths.
  • README updates: Each sample's README now instructs users to cd cs/ or cd ts/ before running aspire run. Root README updated with the same guidance.
  • Cleanup: Removed POLYGLOT_NOTES.md, stale .aspire/settings.json at root, and build artifacts.

Sample directory structure

sample-name/
  cs/                          # C# AppHost
    SampleName.AppHost/
      SampleName.AppHost.csproj
      AppHost.cs
    .aspire/settings.json
  ts/                          # TypeScript AppHost
    apphost.ts
    package.json
    tsconfig.json
    .aspire/settings.json
    .modules/                  # Generated SDK (via aspire add)
  SampleName.ServiceDefaults/  # Shared projects (unchanged)
  SampleName.SomeService/
  SampleName.slnx
  README.md

Running a sample

# C# AppHost
cd samples/<sample-name>/cs
aspire run

# TypeScript AppHost
cd samples/<sample-name>/ts
aspire run

Testing

  • All 14 samples tested with aspire run in both cs/ and ts/28/28 pass
  • C# build passes (0 errors, 0 warnings)
  • Integration tests enumerate correctly (23 test cases)

Copilot AI and others added 2 commits March 3, 2026 15:54
Create TypeScript equivalents of C# AppHost.cs files using the Aspire
polyglot apphost SDK for 14 samples. Each file uses the createBuilder
pattern with camelCase method names and includes POLYGLOT GAP comments
for features not yet available in the TypeScript SDK.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…ap analysis

Create apphost.ts files for 14 samples, converting C# AppHost.cs to
TypeScript polyglot apphost SDK equivalents. Each file uses the Aspire
polyglot SDK pattern (createBuilder/build/run) and documents all
POLYGLOT GAP items where C# features are not available in the
TypeScript SDK.

Add comprehensive POLYGLOT_NOTES.md documenting per-sample gap analysis,
cross-cutting issues, feature availability matrix, and recommendations.

Co-authored-by: IEvangelist <7679720+IEvangelist@users.noreply.github.com>
Copilot AI changed the title [WIP] Update samples to use latest staging Aspire CLI Add polyglot apphost.ts conversions for all samples with gap analysis Mar 3, 2026
@IEvangelist
Copy link
Member

Hey @copilot, while you did an okay job - I think you might need to adjust how you approached this problem slightly. When you create the TypeScript apphost.ts, you need to add integrations using the aspire add {package} command. This is the correct way to add packages with the polyglot approach, and should help resolve the staging packages correctly.

Copilot AI and others added 2 commits March 3, 2026 17:24
Address review feedback: each apphost.ts now includes setup comments
listing which aspire add commands to run for integration packages.
Previously commented-out code (marked as POLYGLOT GAP) is now active
code that uses APIs available after running aspire add. Updated
POLYGLOT_NOTES.md with per-sample setup instructions and revised
feasibility matrix.

Co-authored-by: IEvangelist <7679720+IEvangelist@users.noreply.github.com>
… fixes

Co-authored-by: IEvangelist <7679720+IEvangelist@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Mar 3, 2026

Hey @copilot, while you did an okay job - I think you might need to adjust how you approached this problem slightly. When you create the TypeScript apphost.ts, you need to add integr...

Updated in 781e1e0 and 8e2710f. Each apphost.ts now starts with setup comments listing the required aspire add commands (e.g., aspire add redis, aspire add javascript, aspire add orleans). Previously commented-out code that was marked as "POLYGLOT GAP" is now active code that uses the APIs made available after running the appropriate aspire add commands. The POLYGLOT_NOTES.md has been updated with per-sample setup instructions and a revised feasibility matrix — most samples now show as "Mostly" or "Fully" convertible.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • aspiredev.netlify.app
    • Triggering command: /home/REDACTED/work/_temp/ghcca-node/node/bin/node /home/REDACTED/work/_temp/ghcca-node/node/bin/node --enable-source-maps /home/REDACTED/work/_temp/copilot-developer-action-main/dist/index.js (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Copilot AI changed the title Add polyglot apphost.ts conversions for all samples with gap analysis Add polyglot apphost.ts conversions for all samples with aspire add setup Mar 3, 2026
@IEvangelist
Copy link
Member

Related to dotnet/aspire#14069

…pphost.ts

The stable Aspire CLI (13.1.2 from NuGet) does not include TypeScript
polyglot apphost support. The native staging binary from aspire.dev is
required to detect and run apphost.ts files. Updated POLYGLOT_NOTES.md
to clearly document this, mark all feasibility ratings as expected
rather than confirmed, add a validation checklist, and note the
container runtime prerequisite.

Co-authored-by: IEvangelist <7679720+IEvangelist@users.noreply.github.com>
Copilot AI changed the title Add polyglot apphost.ts conversions for all samples with aspire add setup Add polyglot apphost.ts conversions for all samples with gap analysis Mar 3, 2026
Copilot AI and others added 3 commits March 3, 2026 21:04
Co-authored-by: IEvangelist <7679720+IEvangelist@users.noreply.github.com>
…nfig

Co-authored-by: IEvangelist <7679720+IEvangelist@users.noreply.github.com>
Co-authored-by: IEvangelist <7679720+IEvangelist@users.noreply.github.com>
Copilot AI changed the title Add polyglot apphost.ts conversions for all samples with gap analysis Fix staging Aspire CLI install command for polyglot apphost.ts support Mar 3, 2026
IEvangelist and others added 4 commits March 9, 2026 20:58
Move each sample's AppHost into isolated cs/ and ts/ subdirectories
to enable independent testing of C# and TypeScript AppHosts.

For .csproj-based samples (12):
- C# AppHost project moved to cs/SampleName.AppHost/
- TypeScript apphost.ts extracted to ts/apphost.ts
- Updated .csproj ProjectReferences (../ -> ../../)
- Updated AppHost.cs relative paths where needed
- Updated .slnx AppHost project paths

For file-based samples (container-build, aspire-with-python):
- apphost.cs + settings moved to cs/
- apphost.ts moved to ts/
- Updated relative paths (./ -> ../)

For standalone-dashboard:
- ConsoleApp.cs + settings moved to cs/

Each cs/ and ts/ folder gets its own .aspire/settings.json.
Shared service projects remain at the sample root level.
Build system globs (**/) automatically discover at new depth.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Remove bin/, obj/, and .binlog files left from build validation.
Add 'Sample Directory Structure' section to README.md explaining
the cs/ and ts/ subfolders and how to run each AppHost variant.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Run 'aspire add {integration}' for each ts/ AppHost to generate the
.modules/ TypeScript SDK (aspire.ts, base.ts, transport.ts) and
update .aspire/settings.json with package versions.

Integrations added per sample:
- aspire-shop: postgres, redis
- aspire-with-azure-functions: azure-appcontainers, azure-storage, azure-functions
- aspire-with-javascript: javascript
- aspire-with-node: javascript, redis
- aspire-with-python: javascript, python, redis
- database-containers: postgres, mysql, sqlserver
- database-migrations: sqlserver
- health-checks-ui: redis, docker
- orleans-voting: redis, orleans
- volume-mount: sqlserver, azure-storage

Samples using core APIs only (aspire restore):
- client-apps-integration, container-build, custom-resources, Metrics

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Update the init.sql path to reference the canonical source location
at ../DatabaseContainers.ApiService/data/sqlserver/init.sql instead
of looking for init.sql next to the apphost.ts file.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Deleted all manually-written ts/ directories and recreated them
using 'aspire new aspire-empty --language TypeScript' for proper
scaffolding. Then ran 'aspire add {integration}' for each sample
to generate the .modules/ SDK with correct APIs.

Each apphost.ts is customized to match its C# counterpart with
equivalent resource definitions using the TypeScript SDK.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@IEvangelist IEvangelist marked this pull request as ready for review March 10, 2026 05:09
Copilot AI review requested due to automatic review settings March 10, 2026 05:09
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

This PR updates the repo to support running polyglot TypeScript apphost.ts AppHosts via the staging Aspire CLI, including docs updates and a folder restructure to separate C# vs TypeScript AppHosts.

Changes:

  • Document correct staging Aspire CLI install command and add a polyglot AppHost docs link.
  • Restructure multiple samples into cs/ and ts/ AppHost subfolders, updating slnx/csproj paths accordingly.
  • Add TypeScript AppHost scaffolding files (apphost.ts, tsconfig.json, package.json, run profiles, and Aspire settings) across samples.

Reviewed changes

Copilot reviewed 97 out of 245 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
README.md Documents new cs/ + ts/ sample structure and how to run each AppHost.
samples/POLYGLOT_NOTES.md Adds staging CLI install instructions, polyglot doc link, and detailed per-sample notes.
samples/database-containers/ts/.modules/.codegen-hash Adds TS SDK codegen hash artifact for the sample.
samples/database-containers/ts/.aspire/settings.json Adds staging channel + SDK version + packages for TS polyglot AppHost.
samples/database-containers/cs/DatabaseContainers.AppHost/DatabaseContainers.AppHost.csproj Fixes relative paths after moving AppHost under cs/.
samples/database-containers/cs/DatabaseContainers.AppHost/AppHost.cs Fixes bind mount paths after moving AppHost under cs/.
samples/database-containers/DatabaseContainers.slnx Updates AppHost project path to cs/ directory.
samples/custom-resources/ts/tsconfig.json Adds TS config for polyglot AppHost compilation.
samples/custom-resources/ts/package.json Adds Node dependencies/scripts for TS AppHost.
samples/custom-resources/ts/apphost.ts Adds TS AppHost entrypoint for the sample.
samples/custom-resources/ts/apphost.run.json Adds run profile settings for TS AppHost.
samples/custom-resources/ts/.modules/transport.ts Adds generated/embedded ATS transport implementation for TS SDK.
samples/custom-resources/ts/.modules/base.ts Adds generated/embedded ATS base types for TS SDK.
samples/custom-resources/ts/.aspire/settings.json Adds staging channel + SDK version for TS AppHost.
samples/custom-resources/CustomResources.slnx Updates AppHost project path to cs/ directory.
samples/container-build/ts/tsconfig.json Adds TS config for polyglot AppHost compilation.
samples/container-build/ts/package.json Adds Node dependencies/scripts for TS AppHost.
samples/container-build/ts/apphost.ts Adds TS AppHost entrypoint for the sample.
samples/container-build/ts/apphost.run.json Adds run profile settings for TS AppHost.
samples/container-build/ts/.modules/transport.ts Adds generated/embedded ATS transport implementation for TS SDK.
samples/container-build/ts/.modules/base.ts Adds generated/embedded ATS base types for TS SDK.
samples/container-build/ts/.aspire/settings.json Adds staging channel + SDK version for TS AppHost.
samples/container-build/cs/apphost.cs Fixes relative paths after moving C# AppHost into cs/.
samples/container-build/cs/.aspire/settings.json Adds C# AppHost path mapping for Aspire tooling under cs/.
samples/container-build/.aspire/settings.json Removes root-level Aspire settings after folder restructure.
samples/client-apps-integration/ts/tsconfig.json Adds TS config for polyglot AppHost compilation.
samples/client-apps-integration/ts/package.json Adds Node dependencies/scripts for TS AppHost.
samples/client-apps-integration/ts/apphost.ts Adds TS AppHost entrypoint for the sample.
samples/client-apps-integration/ts/apphost.run.json Adds run profile settings for TS AppHost.
samples/client-apps-integration/ts/.modules/base.ts Adds generated/embedded ATS base types for TS SDK.
samples/client-apps-integration/ts/.aspire/settings.json Adds staging channel + SDK version for TS AppHost.
samples/client-apps-integration/cs/ClientAppsIntegration.AppHost/ClientAppsIntegration.AppHost.csproj Fixes relative project references after moving AppHost under cs/.
samples/client-apps-integration/ClientAppsIntegration.slnx Updates AppHost project path to cs/ directory.
samples/aspire-with-python/ts/tsconfig.json Adds TS config for polyglot AppHost compilation.
samples/aspire-with-python/ts/package.json Adds Node dependencies/scripts for TS AppHost.
samples/aspire-with-python/ts/apphost.ts Adds TS AppHost entrypoint for the sample.
samples/aspire-with-python/ts/apphost.run.json Adds run profile settings for TS AppHost.
samples/aspire-with-python/ts/.modules/base.ts Adds generated/embedded ATS base types for TS SDK.
samples/aspire-with-python/ts/.modules/.codegen-hash Adds TS SDK codegen hash artifact for the sample.
samples/aspire-with-python/ts/.aspire/settings.json Adds staging channel + SDK version + packages for TS polyglot AppHost.
samples/aspire-with-python/cs/apphost.cs Fixes relative paths after moving C# AppHost into cs/.
samples/aspire-with-python/cs/.aspire/settings.json Adds C# AppHost path mapping for Aspire tooling under cs/.
samples/aspire-with-python/.aspire/settings.json Removes root-level Aspire settings after folder restructure.
samples/aspire-with-node/ts/tsconfig.json Adds TS config for polyglot AppHost compilation.
samples/aspire-with-node/ts/package.json Adds Node dependencies/scripts for TS AppHost.
samples/aspire-with-node/ts/apphost.ts Adds TS AppHost entrypoint for the sample.
samples/aspire-with-node/ts/apphost.run.json Adds run profile settings for TS AppHost.
samples/aspire-with-node/ts/.modules/base.ts Adds generated/embedded ATS base types for TS SDK.
samples/aspire-with-node/ts/.modules/.codegen-hash Adds TS SDK codegen hash artifact for the sample.
samples/aspire-with-node/ts/.aspire/settings.json Adds staging channel + SDK version + packages for TS polyglot AppHost.
samples/aspire-with-node/cs/AspireWithNode.AppHost/AspireWithNode.AppHost.csproj Fixes relative project references after moving AppHost under cs/.
samples/aspire-with-node/cs/AspireWithNode.AppHost/AppHost.cs Fixes relative paths after moving AppHost under cs/.
samples/aspire-with-node/AspireWithNode.slnx Updates AppHost project path to cs/ directory.
samples/aspire-with-javascript/ts/tsconfig.json Adds TS config for polyglot AppHost compilation.
samples/aspire-with-javascript/ts/package.json Adds Node dependencies/scripts for TS AppHost.
samples/aspire-with-javascript/ts/apphost.ts Adds TS AppHost entrypoint for the sample.
samples/aspire-with-javascript/ts/apphost.run.json Adds run profile settings for TS AppHost.
samples/aspire-with-javascript/ts/.modules/base.ts Adds generated/embedded ATS base types for TS SDK.
samples/aspire-with-javascript/ts/.modules/.codegen-hash Adds TS SDK codegen hash artifact for the sample.
samples/aspire-with-javascript/ts/.aspire/settings.json Adds staging channel + SDK version + packages for TS polyglot AppHost.
samples/aspire-with-javascript/cs/AspireJavaScript.AppHost/AspireJavaScript.AppHost.csproj Fixes relative project references after moving AppHost under cs/.
samples/aspire-with-javascript/cs/AspireJavaScript.AppHost/AppHost.cs Fixes relative paths after moving AppHost under cs/.
samples/aspire-with-javascript/AspireJavaScript.slnx Updates AppHost project path to cs/ directory.
samples/aspire-with-azure-functions/ts/tsconfig.json Adds TS config for polyglot AppHost compilation.
samples/aspire-with-azure-functions/ts/package.json Adds Node dependencies/scripts for TS AppHost.
samples/aspire-with-azure-functions/ts/apphost.ts Adds TS AppHost entrypoint for the sample.
samples/aspire-with-azure-functions/ts/apphost.run.json Adds run profile settings for TS AppHost.
samples/aspire-with-azure-functions/ts/.modules/base.ts Adds generated/embedded ATS base types for TS SDK.
samples/aspire-with-azure-functions/ts/.modules/.codegen-hash Adds TS SDK codegen hash artifact for the sample.
samples/aspire-with-azure-functions/ts/.aspire/settings.json Adds staging channel + SDK version + packages for TS polyglot AppHost.
samples/aspire-with-azure-functions/cs/ImageGallery.AppHost/ImageGallery.AppHost.csproj Fixes relative project references after moving AppHost under cs/.
samples/aspire-with-azure-functions/ImageGallery.slnx Updates AppHost project path to cs/ directory.
samples/aspire-shop/ts/tsconfig.json Adds TS config for polyglot AppHost compilation.
samples/aspire-shop/ts/package.json Adds Node dependencies/scripts for TS AppHost.
samples/aspire-shop/ts/apphost.ts Adds TS AppHost entrypoint for the sample.
samples/aspire-shop/ts/apphost.run.json Adds run profile settings for TS AppHost.
samples/aspire-shop/ts/.modules/transport.ts Adds generated/embedded ATS transport implementation for TS SDK.
samples/aspire-shop/ts/.modules/base.ts Adds generated/embedded ATS base types for TS SDK.
samples/aspire-shop/ts/.modules/.codegen-hash Adds TS SDK codegen hash artifact for the sample.
samples/aspire-shop/ts/.aspire/settings.json Adds staging channel + SDK version + packages for TS polyglot AppHost.
samples/aspire-shop/cs/AspireShop.AppHost/AspireShop.AppHost.csproj Fixes relative project references after moving AppHost under cs/.
samples/aspire-shop/AspireShop.slnx Updates AppHost project path to cs/ directory.
samples/Metrics/ts/tsconfig.json Adds TS config for polyglot AppHost compilation.
samples/Metrics/ts/package.json Adds Node dependencies/scripts for TS AppHost.
samples/Metrics/ts/apphost.ts Adds TS AppHost entrypoint for the sample.
samples/Metrics/ts/apphost.run.json Adds run profile settings for TS AppHost.
samples/Metrics/ts/.modules/transport.ts Adds generated/embedded ATS transport implementation for TS SDK.
samples/Metrics/ts/.modules/base.ts Adds generated/embedded ATS base types for TS SDK.
samples/Metrics/ts/.aspire/settings.json Adds staging channel + SDK version for TS AppHost.
samples/Metrics/cs/MetricsApp.AppHost/MetricsApp.AppHost.csproj Fixes relative project references after moving AppHost under cs/.
samples/Metrics/cs/MetricsApp.AppHost/AppHost.cs Fixes bind mount paths after moving AppHost under cs/.
samples/Metrics/Metrics.slnx Updates AppHost project path to cs/ directory.
Files not reviewed (9)
  • samples/Metrics/ts/package-lock.json: Language not supported
  • samples/aspire-shop/ts/package-lock.json: Language not supported
  • samples/aspire-with-azure-functions/ts/package-lock.json: Language not supported
  • samples/aspire-with-javascript/ts/package-lock.json: Language not supported
  • samples/aspire-with-node/ts/package-lock.json: Language not supported
  • samples/aspire-with-python/ts/package-lock.json: Language not supported
  • samples/client-apps-integration/ts/package-lock.json: Language not supported
  • samples/container-build/ts/package-lock.json: Language not supported
  • samples/custom-resources/ts/package-lock.json: Language not supported

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

Comment on lines +7 to +16
let ginapp;

if (builder.executionContext.isPublishMode) {
ginapp = builder.addDockerfile("ginapp", "../ginapp")
.withBuildArg("GO_VERSION", goVersion);
} else {
ginapp = builder.addDockerfile("ginapp", "../ginapp", { dockerfilePath: "Dockerfile.dev" })
.withBuildArg("GO_VERSION", goVersion)
.withBindMount("../ginapp", "/app");
}
Copy link

Copilot AI Mar 10, 2026

Choose a reason for hiding this comment

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

With "strict": true in tsconfig.json, let ginapp; introduces an implicit any (noImplicitAny) and should fail tsc. Declare a type (or initialize in a way that infers a concrete type) so the file type-checks under strict mode.

Suggested change
let ginapp;
if (builder.executionContext.isPublishMode) {
ginapp = builder.addDockerfile("ginapp", "../ginapp")
.withBuildArg("GO_VERSION", goVersion);
} else {
ginapp = builder.addDockerfile("ginapp", "../ginapp", { dockerfilePath: "Dockerfile.dev" })
.withBuildArg("GO_VERSION", goVersion)
.withBindMount("../ginapp", "/app");
}
const ginapp = builder.executionContext.isPublishMode
? builder.addDockerfile("ginapp", "../ginapp")
.withBuildArg("GO_VERSION", goVersion)
: builder.addDockerfile("ginapp", "../ginapp", { dockerfilePath: "Dockerfile.dev" })
.withBuildArg("GO_VERSION", goVersion)
.withBindMount("../ginapp", "/app");

Copilot uses AI. Check for mistakes.
IEvangelist and others added 9 commits March 10, 2026 06:56
- Add await on all resource creation assignments
- Import and use ContainerLifetime.Persistent enum instead of string
- Use withHttpHealthCheck({ path: '...' }) object parameter
- Use withServiceReference for project-to-project references
- Use builder.executionContext.get() pattern for conditional logic
- Match patterns from corrected aspire-shop/ts/apphost.ts

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Each sample's 'Running the app' section now explains that users
should cd into cs/ or ts/ before running aspire run, matching
the bifurcated AppHost directory structure.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
… locks

- Updated aspire-shop frontend UI components and styles
- Fixed aspire-shop and aspire-with-javascript apphost.ts
- Updated package-lock.json for Vue and NodeFrontend

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…sting

- container-build: withDeveloperCertificateTrust() requires boolean arg (true)
- orleans-voting: Use addCSharpAppWithOptions for withReplicas support,
  and withOrleansReference instead of withReference for OrleansService

All 14 samples tested with aspire run in both cs/ and ts/ directories.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Remove unused Microsoft.Extensions.Hosting import from apphost.cs
- Change goversion parameter to secret in apphost.ts

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

3 participants