News

5 Blazor Improvements in New .NET 8 Preview 5

Blazor received the lion's share of dev attention for the ASP.NET Core web-dev component in the new .NET 8 Preview 5.

Preview 5 basically marks the halfway point of the .NET 8 schedule, as it will reach general availability in November.

While .NET 8 Preview 5 includes the usual raft of new features and functionality around installers, binaries, container images an so on, much of the action in this cycle concerned ASP.NET Core and its Blazor tooling, which allows for coding web projects in C# instead of JavaScript while taking advantages of new component rendering advancements.

Server-side rendering of Blazor components -- at one time called "Blazor United" -- came in April as part of Preview 3, with Microsoft's Daniel Roth saying: "This is the beginnings of the Blazor unification effort to enable using Blazor components for all your web UI needs, client-side and server-side. This is an early preview of the functionality, so it's still somewhat limited, but our goal is to enable using reusable Blazor components no matter how you choose to architect your app."

Blazor United in .NET 8
[Click on image for larger view.] Blazor United in .NET 8 (February) (source: Microsoft).

Yesterday (June 13), Roth announced the ability for devs to enable interactivity for individual components with Blazor Server.

"In .NET 8 Preview 5 we can now enable interactivity for individual components using the Blazor Server rendering mode," said Roth, principal program manager for ASP.NET. "You can enable interactivity with Blazor Server using the AddServerComponents extension method, and then enable interactivity for specific components using the new [RenderModeServer] attribute."

In response to a reader question, Roth expounded: "In .NET 8 we're expanding Blazor's capabilities so that it can handle all of your web UI needs, both client-side and server-side rendering. As part of this effort we're merging the existing Blazor Server and Blazor WebAssembly hosting models with new capabilities like stateless server-side rendering, streaming rendering, progressive enhancement for navigation & form handling, and the ability to interactivity per component using either Blazor or Blazor WebAssembly." More on that is available in the Full stack web UI with Blazor guidance discussed in Preview 1.

Another Blazor enhancement in Preview 5 is a new Blazor Web App project template, providing a single starting point for using Blazor components to build any style of web UI, rendered from the server or the client (Blazor WebAssembly).

"It combines the strengths of the existing Blazor Server and Blazor WebAssembly hosting models with the new Blazor capabilities we're adding in .NET 8: server-side rendering, streaming rendering, enhanced navigation & form handling, and the ability to add interactivity using either Blazor Server or Blazor WebAssembly on a per component basis," Roth said. "Not all of these features are enabled yet in this preview, but the new Blazor Web App template provides a convenient way to try out these new features as they become available."

The reader comment section discusses how the Blazor App is different from Blazor Server side.

The remaining three Blazor items discussed in the announcement include:

  • Blazor router integration with endpoint routing
  • Improved packaging of Webcil files
  • Blazor Content Security Policy (CSP) compatibility

Beyond Blazor, other ASP.NET Core updates -- with links for more info -- include:

"I'm so excited about the new improvements!" said reader Luciano Garcia. ".NET 8 has exceeded my expectations by far. As an LTS version, I initially thought it would just address some minor issues compared to version 7. Congratulations to the team for all their efforts. Here at our company, we're using Blazor WASM with an API server, and we never want to leave Blazor again. Now, with the hybrid possibility, it has opened up an even broader range of possibilities! It almost feels like magic, this capability. Fantastic!"

About the Author

David Ramel is an editor and writer at Converge 360.

comments powered by Disqus

Featured

  • Compare New GitHub Copilot Free Plan for Visual Studio/VS Code to Paid Plans

    The free plan restricts the number of completions, chat requests and access to AI models, being suitable for occasional users and small projects.

  • Diving Deep into .NET MAUI

    Ever since someone figured out that fiddling bits results in source code, developers have sought one codebase for all types of apps on all platforms, with Microsoft's latest attempt to further that effort being .NET MAUI.

  • Copilot AI Boosts Abound in New VS Code v1.96

    Microsoft improved on its new "Copilot Edit" functionality in the latest release of Visual Studio Code, v1.96, its open-source based code editor that has become the most popular in the world according to many surveys.

  • AdaBoost Regression Using C#

    Dr. James McCaffrey from Microsoft Research presents a complete end-to-end demonstration of the AdaBoost.R2 algorithm for regression problems (where the goal is to predict a single numeric value). The implementation follows the original source research paper closely, so you can use it as a guide for customization for specific scenarios.

  • Versioning and Documenting ASP.NET Core Services

    Building an API with ASP.NET Core is only half the job. If your API is going to live more than one release cycle, you're going to need to version it. If you have other people building clients for it, you're going to need to document it.

Subscribe on YouTube