ASP.NET Core in .NET 11 Preview 1 Brings New Blazor Components, Improved Navigation, and WebAssembly
Summary
Microsoft has released the first preview of ASP.NET Core in .NET 11, introducing significant enhancements for Blazor, OpenAPI, and general web development. Key Blazor additions include the new "EnvironmentBoundary" component for conditional content rendering and improvements to forms with "Label" and "DisplayName" components for accessible labels and metadata display. The "QuickGrid" component now features an "OnRowClick" event. Blazor navigation is enhanced with relative URI support in "NavigationManager.NavigateTo()" and "NavLink", a "GetUriWithHash()" extension, and a "BasePath" component. Blazor WebAssembly gains "IHostedService" support for background services, environment variable access via IConfiguration, and component-specific metrics. Other updates include MathML support, an "InvokeVoidAsync()" analyzer, and OpenAPI schema support for binary file responses.
Key takeaway
For web developers building Blazor applications, this .NET 11 preview streamlines common tasks and expands capabilities. You should explore the new "EnvironmentBoundary" component to manage environment-specific content and leverage the enhanced form components for improved accessibility. The added "IHostedService" support in Blazor WebAssembly also allows you to run background services directly in the browser, simplifying certain application architectures.
Key insights
ASP.NET Core in .NET 11 preview enhances Blazor with new components, navigation, and WebAssembly features.
Principles
- Simplify environment-specific rendering.
- Improve accessibility and localization in forms.
- Enable relative URI navigation for flexibility.
Method
The "EnvironmentBoundary" component conditionally renders content using "Include" or "Exclude" parameters, eliminating manual environment checks across Blazor Server and WebAssembly.
In practice
- Use "EnvironmentBoundary" for environment-specific UI.
- Adopt "Label" and "DisplayName" for accessible forms.
- Utilize relative URI navigation in Blazor apps.
Topics
- ASP.NET Core
- Blazor
- .NET 11
- Web Development
- OpenAPI
Code references
Best for: Product Manager, Software Engineer, Tech Journalist
Related on AIssential
Editorial summary, takeaway, and curation by AIssential. Original article published by InfoQ.