Use Blazor gateway CLI during development - #19432
Use Blazor gateway CLI during development#19432Javier Calvarro Nelson (javiercn) wants to merge 3 commits into
Conversation
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
|
🚀 Dogfood this PR with:
curl -fsSL https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.sh | bash -s -- 19432Or
iex "& { $(irm https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.ps1) } 19432" |
There was a problem hiding this comment.
Pull request overview
Moves run-mode Blazor gateways to the official CLI while retaining the generated gateway for publishing.
Changes:
- Configures
dotnet tool execwith SDK validation. - Preserves project-resource behavior and publish output.
- Adds tests, dependency metadata, and sample documentation.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
tests/Aspire.Hosting.Blazor.Tests/AddBlazorGatewayTests.cs |
Tests run and publish behavior. |
src/Aspire.Hosting.Blazor/BlazorGatewayExtensions.cs |
Launches the CLI during development. |
src/Aspire.Hosting.Blazor/Aspire.Hosting.Blazor.csproj |
Stamps the CLI version. |
playground/BlazorStandalone/README.md |
Documents CLI-based development. |
playground/BlazorStandalone/BlazorStandalone.AppHost/BlazorStandalone.AppHost.csproj |
Adds the Dotnet hosting reference. |
eng/Versions.props |
Pins the CLI package version. |
eng/Version.Details.xml |
Records dependency provenance. |
| Assert.Contains("FROM mcr.microsoft.com/dotnet/sdk:10.0 AS build", dockerfile); | ||
| Assert.Contains("COPY Gateway.cs .", dockerfile); | ||
| Assert.Contains("RUN dotnet publish Gateway.cs -c Release -o /app/publish", dockerfile); | ||
| Assert.Contains("FROM mcr.microsoft.com/dotnet/aspnet:10.0", dockerfile); | ||
| Assert.Contains("COPY --from=build /app/publish .", dockerfile); |
| Command = "dotnet", | ||
| WorkingDirectory = builder.AppHostDirectory | ||
| }) | ||
| .WithAnnotation(new ProjectLaunchArgsOverrideAnnotation(["run"])) |
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
|
Retrying the failed CI jobs for this pull request from the CI run attempt. The rerun is being tracked in the rerun attempt. |
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 11 out of 11 changed files in this pull request and generated 1 comment.
Suppressed comments (1)
src/Aspire.Hosting.Blazor/BlazorGatewayExtensions.cs:37
- The public API documentation omits the new run-mode prerequisite. Callers relying on IntelliSense will only learn that
AddBlazorGatewaynow requires .NET 11 Preview 7 after validation fails; document the minimum SDK here as well as in the playground README.
/// During development the gateway runs from the official .NET tool. The file-based app
/// shipped with this package remains the publish implementation.
| Command = "dotnet", | ||
| WorkingDirectory = builder.AppHostDirectory |
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.
Note
This error may be related to your runner configuration. You can now configure runners for Copilot code review separately from Copilot cloud agent by creating a copilot-code-review.yml file with your setup steps. Read the docs for details.
|
does this break aspire runs in vs code? |
Have not explicitly tried VS Code, but how would it break it? (Dashboard works fine) |
Description
Standalone Blazor WebAssembly apps now use the official Blazor Gateway CLI during local development instead of launching Aspire's generated file-based gateway. This keeps development aligned with the ASP.NET Core gateway implementation while preserving the existing
AddBlazorGatewayAPI, project resource/dashboard experience, endpoints, certificates, telemetry, and client resource relationships.The run-mode project resource is launched as a process through:
The CLI version is centrally pinned and requires the .NET 11 Preview 7 SDK or later. Publish behavior intentionally retains the generated
Gateway.csand its existing SDK 10 runtime image.The standalone WASM client now targets .NET 11 Preview 7 and enables the SDK's canonical SPA fallback contract:
Aspire removes SDK-generated or legacy fallback endpoints before adding one path-prefixed identity fallback using the canonical
{**fallback:nonfile}route and stringOrder="2147483647". The same transformation is used during publish. Existing net10 clients retain the SDK 10 publish image, while net11 clients use the Preview 7 SDK image.The built-in gateway also suppresses the obsolete
Gateway.cssource display while retaining itsProjectResourcemodel shape.User-facing usage
The existing C# API is unchanged:
Validation
Aspire.Hosting.Blazor.Testspassed.ResourceSourceViewModeldashboard model cases passed.{**fallback:nonfile}endpoints with string order.Fixes # (issue)
Checklist
<remarks />and<code />elements on your triple slash comments?