Skip to content

feat: add an Aspire option to the unoapp template - #2449

Draft
Kunal22shah wants to merge 6 commits into
mainfrom
dev/ks/aspire-apphost
Draft

Kunal22shah wants to merge 6 commits into
mainfrom
dev/ks/aspire-apphost

Conversation

@Kunal22shah

@Kunal22shah Kunal22shah commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

GitHub Issue (If applicable): related to unoplatform/uno#26714, unoplatform/uno.extensions#3309, unoplatform/uno.extensions#3310, unoplatform/uno.extensions#3311

PR Type

  • Feature

What is the current behavior?

There is no template option for Aspire. To run an Uno app under Aspire, users create the AppHost, the Server's service defaults and the app's settings by hand.

What is the new behavior?

A new Aspire option (-aspire, and a card in the wizard after Server). It adds an Aspire AppHost that starts the app's desktop and WebAssembly heads, and the Server when there is one, with the dashboard for their logs, traces and metrics:

var api = builder.AddDotnetProject("api", "../MyApp.Server/MyApp.Server.csproj");

var app = builder.AddUnoProject("app", "../MyApp/MyApp.csproj");
app.AddDesktop().WithReference(api).WaitFor(api);
var wasm = app.AddWebAssembly().WithReference(api).WaitFor(api);
api.WithEnvironment("Cors__Origin", wasm.GetEndpoint("http"));
  • App: Aspire in UnoFeatures and .UseServiceDefaults(). With the Server, the API client calls https+http://api. A head started outside the AppHost (Android, iOS, Windows, or desktop from the IDE) falls back to the Server's local address as before.
  • Server: a ServiceDefaults project (Aspire's standard one), AddServiceDefaults() and MapDefaultEndpoints(). With Serilog, logs are forwarded so they reach the dashboard. CORS only allows the WebAssembly origin the AppHost passes.
  • Needs dependency injection (-aspire turns it on unless -di false) and the desktop or WebAssembly platform. It works without the Server.
  • AppHost ports are generated per project. Rider and VS Code get an AppHost launch entry.
  • Versions: Aspire 17.0.0, and Uno.Extensions.Aspire.Hosting on the Uno.Extensions version the Uno.Sdk ships, written by the updater.

Important

Draft until the dependencies ship: the Aspire UnoFeature in the Uno.Sdk (unoplatform/uno#26714), and Uno.Extensions.Aspire / Uno.Extensions.Aspire.Hosting (the PRs above). The two new CI scenarios, AspireServer and AspireBlank, fail until then.

Reviewer's guide

  • Start with MyExtensionsApp.1.AppHost/AppHost.cs and the aspire symbols in template.json.
  • ServiceDefaults/Extensions.cs is Aspire 17's aspire-servicedefaults template, unchanged.
  • The .sln changes are mechanical: two projects, their configurations, and nesting under Source.
  • docs: add the Aspire AppHost spec is docs only.

Verification

Generated from this branch (isolated template hive), with local builds of the unreleased packages:

  • recommended -server -aspire, -aspire (blank), -aspire -di false, and -aspire -platforms android ios: the AppHost appears only in the first two.
  • The AppHost, Server and desktop head build with no warnings.
  • Run from the AppHost: the desktop and WebAssembly heads call the Server by name, and one trace covers both the app and the Server. With Serilog, the Server's logs reach the dashboard.
  • A desktop head started directly, and the Android head, use the fallback address.
  • build/Test-WizardOptions.ps1 and build/Test-WizardIcons.ps1 pass, and the card renders in the wizard.

Not run: the iOS and Windows heads.

PR Checklist

Please check if your PR fulfills the following requirements:

  • Associated with an issue (GitHub or internal)

🤖 Generated with Claude Code

@github-actions github-actions Bot added area/automation Categorizes an issue or PR as relevant to project automation area/solution-templates Categories an issue or PR as relevant to the Solution Templates area/sdk Categorizes an issue or PR as relevant to the Uno.Sdk labels Nov 24, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/automation Categorizes an issue or PR as relevant to project automation area/sdk Categorizes an issue or PR as relevant to the Uno.Sdk area/solution-templates Categories an issue or PR as relevant to the Solution Templates

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant