Skip to content

Conversation

@guardrex
Copy link
Collaborator

@guardrex guardrex commented Dec 23, 2025

Fixes #36486

Adds the article as ...

  • Title: Combine Blazor Hybrid with .NET MAUI and Razor class libraries (RCLs)
  • Physical location/URL: aspnetcore/blazor/hybrid/class-libraries-best-practices.md
  • UID: blazor/hybrid/class-libraries-best-practices
  • ToC (under Blazor Hybrid after the Class lib article link): Class libraries best practices

I versioned this at >=6.0, but I believe that at least some of the API (e.g., Microsoft.Maui.Devices.DeviceInfo) is >=9.0. Should the article be versioned >=9.0?


Internal previews

📄 File 🔗 Preview link
aspnetcore/blazor/hybrid/class-libraries-best-practices.md aspnetcore/blazor/hybrid/class-libraries-best-practices
aspnetcore/blazor/hybrid/reuse-razor-components.md aspnetcore/blazor/hybrid/reuse-razor-components
aspnetcore/toc.yml aspnetcore/toc

@guardrex guardrex self-assigned this Dec 23, 2025
@guardrex guardrex marked this pull request as ready for review January 5, 2026 17:04
@guardrex guardrex requested a review from Copilot January 5, 2026 17:08
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 adds a new best practices article that guides developers on creating Razor class libraries (RCLs) that combine .NET MAUI and Blazor Hybrid functionality. The article demonstrates the recommended architectural pattern of host-agnostic design where RCLs define abstractions through interfaces, and platform-specific implementations are provided via dependency injection.

Key changes:

  • Introduces comprehensive guidance on separating platform-agnostic Razor components from MAUI-specific implementations
  • Provides step-by-step instructions for creating RCLs, MAUI class libraries, and integrating them in MAUI Blazor apps
  • Includes practical code examples demonstrating the abstraction pattern with device info services

Reviewed changes

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

File Description
aspnetcore/blazor/hybrid/class-libraries-best-practices.md New article explaining best practices for combining Blazor Hybrid with .NET MAUI and RCLs, including architecture patterns, code examples, and troubleshooting guidance
aspnetcore/toc.yml Adds the new article to the Table of Contents under Blazor Hybrid section after the Class libraries article

Copy link
Contributor

@BethMassi BethMassi left a comment

Choose a reason for hiding this comment

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

This LGTM. We should probably also link to this article from this page too: https://review.learn.microsoft.com/en-us/aspnet/core/blazor/hybrid/reuse-razor-components

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.

[Blazor] Docs on best practices for maui and razor class libraries.

3 participants