News

.NET 6 Gets Blazor WebView Controls for WPF, WinForms

Along with initial support for Hot Reload functionality, the new .NET 6 Preview 3 also introduces BlazorWebView controls for Windows Presentation Foundation (WPF) and Windows Forms (WinForms) apps.

With the controls, developers can embed Blazor code into existing apps that run on .NET 6, a unifying, all-things-.NET umbrella framework going GA in November. It's a big milestone for Blazor, which debuted as a way to code web apps with C# without having to use JavaScript but is gradually being pointed at other targets, including mobile apps. Blazor Desktop has received a lot of attention in the Microsoft-centric developer space.

The WPF/WinForms BlazorWebView controls are being introduced in Preview 3 as part of Microsoft's plan to support cross-platform hybrid desktop apps in .NET 6 using .NET MAUI (.NET Multi-platform App UI), which is an evolution of Xamarin.Forms that adds desktop support.

"Hybrid apps are native apps that leverage web technologies for their functionality," said Microsoft's Daniel Roth, principal program manager, ASP.NET, in an April 8 blog post. "For example, a hybrid app might use an embedded web view control to render web UI. This means you can write your app UI using web technologies like HTML & CSS, while also leveraging native device capabilities. We will be introducing support for building hybrid apps with .NET MAUI and Blazor in an upcoming .NET 6 preview release."

For now, Roth's post explains how to use the BlazorWebView controls in both WPF and WinForms, with simple counter examples shown below just to prove they work, though numerous steps are required. Some developers already created other working examples, such as this BlazorDesktopWPF demo project that balked at adding Razor components, a problem fixed by Roth with a pull request.

A Blazor WinForms App
[Click on image for larger view.] A Blazor WinForms App (source: Microsoft).
A Blazor WPF App
[Click on image for larger view.] A Blazor WPF App (source: Microsoft).

"Using Blazor and a hybrid approach you can start decoupling your UI investments from WPF & Windows Forms," Roth continued. "This is a great way to modernize existing desktop apps in a way that can be brought forward onto .NET MAUI or used on the web. You can use Blazor to modernize your existing Windows Forms and WPF apps while leveraging your existing .NET investments."

As for two other much-requested features, Preview 3 adds initial Hot Reload support, but ahead-of-time (AoT) compilation is still on tap, with some potential drawbacks.

"WebAssembly AoT is coming in .NET 6 as well and it should be available in soon in an upcoming .NET 6 preview," said Roth in response to a reader question. "The performance improvements are looking really good! The tradeoff is a larger download size (~2x larger), a heavier toolchain (involves using Emscripten), and a longer publish time (minutes instead of seconds)."

Read Roth's post ("ASP.NET Core updates in .NET 6 Preview 3") for more, including:

  • Smaller SignalR, Blazor Server, and MessagePack scripts
  • Enable Redis profiling sessions
  • HTTP/3 endpoint TLS configuration
  • Razor compiler no longer produces a separate Views assembly
  • Shadow-copying in IIS
  • Vcpkg port for SignalR C++ client
  • Reduced memory footprint for idle TLS connections
  • Remove slabs from the SlabMemoryPool

About the Author

David Ramel is an editor and writer at Converge 360.

comments powered by Disqus

Featured

  • Claude AI Gets Yet Another Boost in VS Code 1.128

    The July 8, 2026, Visual Studio Code update expands agent workflows, chat attachments, browser-tab controls, OS-level shortcuts and enterprise telemetry management.

  • TypeScript 7 Arrives to Rock VS Code with Go-Powered Speed

    Microsoft says TypeScript 7, announced July 8, brings native Go performance to VS Code, Visual Studio and other editors.

  • Full-Stack with a Side of Copilot: Building and Deploying an App the AI-Accelerated Way

    In this Q&A, developer and VSLive! speaker Esteban Garcia explains how GitHub Copilot can accelerate the full software development lifecycle -- from architecture and code to tests, CI/CD, and Azure deployment -- and how to use it as a repeatable engineering workflow rather than just a faster autocomplete tool.

  • VS Code 1.127 Further Integrates Advanced Browser-AI Tech

    Microsoft's July 1 Visual Studio Code update continues a recent push to make the editor's integrated browser a more capable development surface -- and a more useful tool for AI agents.

Subscribe on YouTube