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

  • Build Your First AI Applications with Local AI

    "AI right now feels like a vast space which can be hard to jump into," says Craig Loewen, a senior product manager at Microsoft who is helping devs unsure about making that first daunting leap.

  • On Blazor Component Reusability - From Day 0

    "We want to try to design from Day One, even Day Zero, with reusability in mind," says Blazor expert Allen Conway in imparting his expertise to an audience of hundreds in an online tech event on Tuesday.

  • Decision Tree Regression from Scratch Using C#

    Dr. James McCaffrey from Microsoft Research presents a complete end-to-end demonstration of decision tree regression using the C# language. Unlike most implementations, this one does not use recursion or pointers, which makes the code easy to understand and modify.

  • Visual Studio's AI Future: Copilot .NET Upgrades and More

    At this week's Microsoft Ignite conference, the Visual Studio team showed off a future AI-powered IDE that will leverage GitHub Copilot for legacy app .NET upgrades, along with several more cutting-edge features.

  • PowerShell Gets AI-ified in 'AI Shell' Preview

    Eschewing the term "Copilot," Microsoft introduced a new AI-powered tool for PowerShell called "AI Shell," available in preview.

Subscribe on YouTube