First .NET 6 Preview Introduces Blazor Desktop

Microsoft shipped the first preview of .NET 6, expected to debut in November as the culmination of a years-long effort to provide an open source, cross-platform framework for all things .NET in one unifying umbrella offering.

That effort to transform the old, Windows-only .NET Framework to a modern product started with .NET Core and moved on to .NET 5, which was supposed to unify .NET with a November 2020 debut but which failed due to the pandemic and other issues. So .NET 6 will complete that effort with the capability to create apps for desktop, web, cloud, mobile, gaming, IoT, AI and more running on Windows, Linux, Android, iOS, Mac/Mac Catalyst, Windows Arm64, iOS/tvOS and more. It does that by bringing formerly disparate components like Xamarin under the umbrella (hence the iOS/Android/macOS functionality).

"A big change this release is fully integrating Android and iOS as part of the existing Xamarin workloads," said Microsoft's Richard Lander. "That requires the obvious requirement to integrating a bunch of code, build systems, and other technology. It also requires integrating blogs, docs, and samples. While we've worked with the Xamarin team for many years, we welcome all of our Xamarin friends to the .NET 6 project. We also welcome Xamarin users to being a part of .NET 6."

In .NET 6, the dev team will specifically focus on app performance, adding new control themes, and faster developer experiences, Lander said.

.NET 6 Preview 1 begins to tackle those goals with a host of new features and grand plans, including introducing Blazor desktop, an offshoot of Microsoft's red-hot ASP.NET Core component that allows for C# web development instead of JavaScript through the use of WebAssembly.

We recently mentioned the mysterious Blazor desktop effort in a roundup of the dizzying array of desktop dev options that Microsoft now provides, including WPF, WinForms, UWP, .NET MAUI, Win UI, Project Reunion and so on, even though little was known about it.

Now we know more.

"We first supported Blazor on the server, then in the browser with WebAssembly, and now we're extending it again, to enable you to write Blazor desktop apps," said Lander in announcing the new Preview 1 on Feb. 17. "Blazor desktop enables you to create hybrid client apps, which combine web and native UI together in a native client application. It is primarily targeted at web developers that want provide rich client and offline experiences for their users."

That effort stems from an Oct. 26, 2020, GitHub issue (#27217) titled "Epic: Blazor developers can target and deploy their applications to desktop platforms, allowing them to run natively."

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

"Blazor desktop offers a lot of choice on how you construct your application," Lander said. "At one end of the application spectrum, you can use Blazor and web technologies for all aspects of the client application experience with the exception of the outer-most native application container (like the title bar). On the other end of the spectrum, you can use Blazor desktop for targeted functionality within an otherwise native app (like WPF), like a user profile page that you've already implemented for your Blazor-based website. All the choices in between are equally possible. We are building Blazor desktop initially for .NET apps, but there is no technical reason why you couldn't use it in a desktop app built with another app stack, like for example Swift.

"Blazor is built on top of .NET Multi-platform App UI. It relies on that UI stack for a native application container and native controls (should you want to use them). We are building Blazor to have startup and throughput performance on par with other desktop solutions. For developers that love Blazor and love web technologies, we think that Blazor is going to be a great choice for building desktop apps."

The term "epic" in the above GitHub issue is used in Microsoft's Themes of .NET site, where the company tracks the development of .NET 6 in a formal structure that categorizes initiatives as themes, user stories, issues and epics, the latter described as "a higher level grouping of related user stories, it can span up to the entire release. For example 'Enterprises have a first class experience acquiring and deploying .NET 6.0'"

Themes of .NET
[Click on image for larger view.] Themes of .NET (source: Microsoft).

Microsoft points to that site for developers to keep informed about .NET 6 because the dev team is now using GitHub issues to plan the product release instead of Azure DevOps, which was used to plan for .NET 5.

Lander's huge, finely detailed post also covers other parts of .NET 6 in addition to Blazor desktop and .NET MAUI, including:

  • .NET Multi-platform App UI: Standing for .NET Multi-platform App UI, this is a modern UI toolkit that builds upon and extends Xamarin as part of .NET 6 unification. Key focus areas for .NET 6 include: app performance, adding new control themes and faster developer experiences.
    MAUI (.NET Multi-platform App UI)
    [Click on image for larger view.] MAUI (.NET Multi-platform App UI) (source: Microsoft).
  • Fast inner loop: This comes from another GitHub issue (#5510) and refers to what Lander calls fast iterative development provided by any delightful and productive development platform. The dev team is first making the build run much faster via performance-related projects. One notable item here is hot reload functionality, long requested and finally implemented (and improved in November) by Xamarin in November and now being eyed as a general .NET capability for C#/IL as well as XAML. "We're defining a new hot code reload model that we can offer for all app types. It's likely at least some of this feature will be implemented in the runtime, and we're committed to doing that with both CoreCLR and Mono. We want to enable a very fast build, and even faster operations for code changes that can skip the build entirely, as a new standard feature of .NET."
  • ARM64: The team will focus mostly on functional enablement here after improving Arm64 performance in .NET 5.0, an effort that will also continue.
  • Containers: A bevy of projects are underway to improve the .NET container experience, touching upon scaling, reduced size, increased startup and throughput performance, large page support and more.

As far was what's new in .NET 6 Preview 1, that's all conveniently presented in a GitHub issue appropriately titled "What's new in .NET 6 Preview 1." Some highlights there include:

  • Targeting .NET 6: This is done via target framework monikers (TFMs), a standardized token format for specifying the target framework of a .NET app or library that was used for .NET 5. Now there are new ones for .NET 6.
  • .NET CLI: This is more convenient to use after the team adopted System.CommandLine libraries, which added three primary features: "response files" and two different kinds of directives.
  • Libraries: New offerings here include:
    • System.Numerics -- new math APIs
    • Improved support for Windows access control lists (ACLs)
    • Portable thread pool
  • Runtime: There's too much new stuff going on here to list in this article, but one main feature is support for Apple Silicon, which is that company's own ARM64 chip. Also, single file apps -- previously supported only on Linux in .NET 5 -- are now supported for Windows and macOS.

".NET 6 promises to be another exciting release with many compelling improvements," Lander said in his conclusion. "It is a particularly interesting release because it contains changes as a result of needing to adapt to externally focused operating system evolution, and also continuing to innovate within the .NET platform itself. It is also the continuation of increased openness from the .NET team, both in terms of open planning but also sharing previously proprietary performance tools. We haven't achieved it just yet, but .NET 6 will be the second November release in a row, in our new annual cadence. Given the success of shipping .NET 5 in November 2020, in a very challenging environment, there is every reason to expect .NET 6 will also be released on time."

.NET 6 has been tested with Visual Studio 16.9 Preview 4 and Visual Studio for Mac 8.9 and Microsoft recommends using those builds to try .NET 6. Preview 1 can be downloaded here.

Microsoft also announced Entity Framework Core 6.0 Preview 1 and highlighted ASP.NET Core updates in .NET 6 Preview 1.

About the Author

David Ramel is an editor and writer for Converge360.

comments powered by Disqus


Subscribe on YouTube