
- •Table of Contents
- •About the Author
- •Acknowledgments
- •Introduction
- •Version Support
- •Supported Versions
- •A Unified Platform
- •Roadmap
- •Supported Operating Systems
- •Command Line Interface
- •Desktop Development
- •Blazor
- •MAUI
- •Wrapping Up
- •.NET 6 Architecture
- •Runtimes
- •CoreCLR
- •Mono
- •WinRT
- •Managed Execution Process
- •Desktop Packs
- •Wrapping Up
- •Dotnet New
- •Dotnet Restore
- •NuGet.config
- •Dotnet Build
- •Dotnet Publish
- •Dotnet Run
- •Dotnet Test
- •Using the CLI in GitHub Actions
- •Other Commands
- •Wrapping Up
- •WinAPI
- •WinForms
- •STAThread
- •WinForms Startup
- •DPI Mode
- •Responding to Scale Events
- •Visual Styles
- •Text Rendering
- •The Message Loop
- •The Form Designer
- •WPF Startup
- •XAML Layout
- •Visual Tree
- •Data Binding
- •Windows App SDK
- •Building a Windows App SDK application
- •Using Windows APIs with Windows App SDK
- •Packaging
- •Migrating to .NET 6
- •Upgrade Assistant
- •Wrapping Up
- •Blazor WebAssembly
- •Creating a Blazor Wasm Project
- •Blazor Progressive Web Apps
- •Exploring the Blazor Client Project
- •Blazor in .NET 6
- •Blazor Component System
- •Creating Blazor Pages
- •Running a Blazor App
- •Blazor Server
- •SignalR
- •Blazor Desktop
- •Wrapping Up
- •Project Structure
- •Exploring MAUI
- •The Cross-Platform World
- •Application Lifecycle
- •MVVM
- •MVVM Toolkit
- •Wrapping Up
- •Model-View-Controller
- •Routing
- •Views
- •Controllers
- •Controller-Based APIs
- •Minimal APIs
- •Wrapping Up
- •Web Apps
- •Creating an App Service
- •Static Web Apps
- •Web App for Containers
- •Docker
- •Azure Functions
- •Deploying Azure Functions
- •Wrapping Up
- •Record Types
- •Monolith Architecture
- •Microservices
- •Container Orchestration
- •Kubernetes
- •Docker Compose
- •Dapr
- •Installing Dapr
- •Dapr State Management
- •Wrapping Up
- •Roslyn
- •Compiler API
- •Diagnostic API
- •Scripting API
- •Workspace API
- •Syntax Tree
- •Roslyn SDK
- •Source Generators
- •Writing a Source Generator
- •Debugging Source Generators
- •Wrapping Up
- •Garbage Collector
- •The Heap
- •The Stack
- •Garbage Collection
- •A Look at the Threadpool
- •Async in .NET 6
- •Await/Async
- •Cancellations
- •WaitAsync
- •Conclusion
- •Index

Chapter 1 A Tour of .NET 6
native Windows UI through WPF. This enables a very interesting scenario where parts of a web application can be refactored into web components to be used on both a web application and a native application.
We’ll learn more about Blazor in Chapter 5 of this book.
MAUI
WPF, WinForms, and the Windows App SDK are all tightly coupled to Windows. A more cross-platform solution from Microsoft is called the .NET Multi-Platform App UI. The
.NET Multi-Platform App UI, MAUI for short, is one of the biggest new parts in .NET 6. It basically is the new version of Xamarin Forms, but it’s more than that. MAUI brings an entire new project system, no longer fiddling around with at least three projects in your mobile app solution. One project that contains all your mobile heads, assets, and shared code. Everything together in one .NET project.
Figure 1-14. Single project for iOS, Android, and Mac Catalyst
MAUI no longer focuses solely on mobile either; it’s now a full-fledged solution for building cross-platform, cross-idiom applications. Xamarin Forms has had support for UWP for quite some time, but it was never an important part of the framework, which resulted in a poor developer and user experience. With MAUI we can target Android, iOS, macOS, and Windows. All as first-class citizens. For Windows, this means improved UWP support, by leveraging the Windows App SDK.
17
Chapter 1 A Tour of .NET 6
As for XAML flavor, if you’re building a cross-platform application with MAUI, you’ll be using the same flavor of XAML you’re used to from Xamarin Forms. As for
macOS, Xamarin Forms has support for macOS through AppKit bindings; that support is still there.
Apple is now taking a different route for macOS development and has introduced Mac Catalyst, a framework that enables developers to build macOS desktop applications with UIKit. MAUI includes bindings for both AppKit and Mac Catalyst to suit every developer’s needs. However, since Mac Catalyst is the default for Apple, MAUI also takes this as the default framework for macOS-based applications.
Getting a Xamarin Forms installation up and running has been notoriously hard so far. It’s one of the most heard complaints from developers trying to get into Xamarin. You’d need to install Visual Studio with the correct mobile workload and install the correct UWP SDK versions, Android SDK version, and iOS SDK versions. Next to that, if you want to build iOS apps on Windows, you’ll need a mac with the correct version of Visual Studio for Mac, Mono, and iOS SDK installed. With .NET 6 comes a tool that can check your system for MAUI compatibility and install all missing pieces for you. In pure .NET fashion, it’s a command line tool that you can install through the dotnet command line.
To install:
dotnet tool install -g Redth.Net.Maui.Check
To Run:
maui-check
Running the tool will launch it in a new CLI window.
18

Chapter 1 A Tour of .NET 6
Figure 1-15. Maui-check checking for JDK, VS2022, and Android SDKs
The tool is community supported and open source; the source can be found at https://github.com/Redth/dotnet-maui-check.
Maui-check looks for:
•\ |
OpenJdk/AndroidSDK |
•\ |
.NET 6 SDK |
•\ |
.NET MAUI/iOS/Android workloads and packs |
•\ |
.NET MAUI Templates |
•\ |
Workload Resolver .sentinel files for .NET and Visual Studio |
|
Windows/Mac |
We’ll dive deeper into MAUI in Chapter 6 of this book.
19
Chapter 1 A Tour of .NET 6
Wrapping Up
In this introductory chapter, we reviewed .NET roadmap and its history. I hope this chapter gave you a sense of what .NET 6 is about and made you eager to dive deeper into the latest release of .NET. The different concepts that we have touched upon in this chapter will be explored further in the rest of the book. We will take a closer look at
.NET tooling with the command line interface; we will explore desktop development in WPF, WinForms, and the Windows App SDK. We will learn about building powerful web applications that run on the client with Blazor and how to build cross-platform mobile apps with MAUI.
While not an exhaustive list of everything .NET 6 offers, we have selected the most important parts of .NET 6. .NET 6 is a big and important release; it brings a plethora of new features and new paradigms to the framework. Consequent chapters in this book will cover many of those and go into much more detail. Before we dive into all the feature goodness, let’s take a look under the hood in Chapter 2 and explore the various runtimes and extensibility packs.
20