Skip to content

Conversation

@javiercn
Copy link
Member

Summary

Add a new project template blazor-wasm-servicedefaults for creating service defaults libraries for Blazor WebAssembly applications with .NET Aspire integration.

Features

  • OpenTelemetry support: Logging, metrics, and tracing with standard OTLP exporter
  • Service discovery integration: Via Microsoft.Extensions.ServiceDiscovery
  • HTTP resilience: Standard resilience handler via Microsoft.Extensions.Http.Resilience

Template Usage

dotnet new blazor-wasm-servicedefaults -o MyBlazorApp.ServiceDefaults

Then reference it from your Blazor WebAssembly client and call:

builder.AddBlazorClientServiceDefaults();

Changes

New Files

  • BlazorWasmServiceDefaults-CSharp template content (Extensions.cs)
  • Template configuration (template.json) and localization files (14 languages)
  • BlazorWasmServiceDefaults-CSharp.csproj.in for package version substitution

Modified Files

  • eng/Versions.props: Added package versions for OpenTelemetry and Extensions packages
  • Microsoft.DotNet.Web.ProjectTemplates.csproj: Added generated content entry and version variables
  • template-baselines.json: Added baseline for the new template

Tests

  • BlazorWasmServiceDefaultsTemplateTest.cs: Basic template test (create, publish, build)

Related

This template follows the same pattern as the MAUI service defaults template in dotnet/maui.

Add a new project template 'blazor-wasm-servicedefaults' for creating
service defaults libraries for Blazor WebAssembly applications with
.NET Aspire integration.

Features:
- OpenTelemetry support (logging, metrics, and tracing)
- Service discovery integration
- HTTP resilience with standard resilience handler
- Uses standard OpenTelemetry OTLP exporter

New files:
- BlazorWasmServiceDefaults-CSharp template content
- Template configuration and localization files (14 languages)
- Template test and baseline configuration
- Package version definitions for OpenTelemetry and Extensions packages
@github-actions github-actions bot added the area-mvc Includes: MVC, Actions and Controllers, Localization, CORS, most templates label Dec 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area-mvc Includes: MVC, Actions and Controllers, Localization, CORS, most templates

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants