Nico Vermeir
Introducing .NET 6
Getting Started with Blazor, MAUI, Windows App SDK, Desktop Development, and Containers
Logo of the publisher
Nico Vermeir
Merchtem, Belgium
ISBN 978-1-4842-7318-0 e-ISBN 978-1-4842-7319-7
https://doi.org/10.1007/978-1-4842-7319-7
Nico Vermeir 2022
This work is subject to copyright. All rights are solely and exclusively licensed by the Publisher, whether the whole or part of the material is concerned, specifically the rights of translation, reprinting, reuse of illustrations, recitation, broadcasting, reproduction on microfilms or in any other physical way, and transmission or information storage and retrieval, electronic adaptation, computer software, or by similar or dissimilar methodology now known or hereafter developed.
The use of general descriptive names, registered names, trademarks, service marks, etc. in this publication does not imply, even in the absence of a specific statement, that such names are exempt from the relevant protective laws and regulations and therefore free for general use.
The publisher, the authors and the editors are safe to assume that the advice and information in this book are believed to be true and accurate at the date of publication. Neither the publisher nor the authors or the editors give a warranty, expressed or implied, with respect to the material contained herein or for any errors or omissions that may have been made. The publisher remains neutral with regard to jurisdictional claims in published maps and institutional affiliations.
This Apress imprint is published by the registered company APress Media, LLC part of Springer Nature.
The registered company address is: 1 New York Plaza, New York, NY 10004, U.S.A.
Introduction
Welcome to .NET 6! A very exciting new release of Microsofts managed application runtime and SDK..NET 6 is a release that has been long in the making; it is the next step in the one .NET dream. In this book, we will discover what .NET 6 has to offer; we will learn about exciting updates on existing frameworks like WinForms and WPF and discover new things like Minimal APIs.
We will start with a quick tour around .NET 6 in the first chapter, just to get a feel of how big this .NET release really is. In the next chapter, we will go a bit more technical and see what the different runtimes are and how a cross-platform framework like .NET still manages to run native applications on Windows, mobile, and more. In Chapter , we will learn about the different application frameworks .NET hosts, from native Windows desktop to web applications with ASP.NET Core to cross-platform mobile applications. From there, we cross over into the cloud and see Azures support for .NET 6. The final three chapters are a bit more advanced; we go into application architecture and what .NET 6 and C# 10 features help write better architectured code, and we take a look at the compiler platform, or Roslyn. And finally we end on a chapter with some more advanced topics like threading and async/await.
The book is written in a demo-based manner. Feel free to pull up your computer and follow along while reading; all the steps are explained so that we can discover the topics together.
Happy learning!
Any source code or other supplementary material referenced by the author in this book is available to readers on GitHub via the books product page.
Acknowledgments
Thank you to the great people at Apress for the support during the writing of this book.
Thank you Damien Foggon for the technical review; youve helped me grow as an author and made this a better book.
A big thank you to the worldwide .NET community. Each and every one of you keeps pushing me every day to grow as a developer, as a community member, and as a person.
Table of Contents
About the Author
Nico Vermeir
is a Microsoft MVP in the field of Windows development. He works as an application architect at Inetum-Realdolmen Belgium and spends a lot of time keeping up with the rapidly changing world of technology. He loves talking about and using the newest and experimental technologies in the .NET stack. Nico cofounded MADN, a user group focusing on building modern applications in .NET. He regularly presents on the topic of .NET at user groups and conferences.
In his free time, you can find him enjoying rides on his motorcycle, jamming on his guitar, or having a beer with friends.
The Author(s), under exclusive license to APress Media, LLC, part of Springer Nature 2022
N. Vermeir Introducing .NET 6 https://doi.org/10.1007/978-1-4842-7319-7_1
1. A Tour of .NET 6
Welcome to .NET 6! An exciting new release of Microsofts popular framework. .NET 6 is the next big step in delivering the one .NET vision. The vision that would unify all of .NET to have a single runtime for mobile, Web, IoT, games, and many more targets.
In this first chapter, we will look at the versioning of .NET, together with its support timeframes and release schedule. We will go over the supported operating systems, what it means to have a unified platform, and how to get started with .NET 6 using the command line interface.
.NET 6
The .NET framework has been around since the year 2000. Over the years, it has grown into a very mature, popular framework that could target many platforms. However, sharing code between those different platforms was not an easy task because of how the .NET framework was built. With .NET Core, Microsoft wanted to start from a clean slate using .NET Standard as a way to share code between the different platforms. They took the API surface of the base class library and started implementing everything anew, using modern techniques and APIs to improve performance of the framework..NET Standard was created as an interface. It exposed parts of the BCL API; .NET Core is an implementation of that .NET Standard interface. Because .NET Standard was an abstraction, we could create .NET Standard class libraries that could be referenced from every type of platform, as long as they used the correct version of .NET Core. This quickly became confusing as .NET Core 3 was using .NET Standard 2.1, but .NET Standard 1.6 was .NET Core 1.0. The next step in unifying all of .NET was taken with .NET 5..NET 5, which was actually .NET Core 4, was the release where .NET Core became the successor of the classic .NET Framework. The final release of the classic .NET Framework is 4.8; from that moment on, .NET Core is the main branch of the framework. To avoid confusion, later on .NET Core was renamed to simply .NET and the versioning of the classic .NET framework was taken over, hence .NET 5..NET Standard disappeared as well; as of .NET 5, we just have .NET 5 class libraries and those are compatible with every platform that is on .NET 5..NET 6 is one of the final steps in unifying the platform as it unifies Mono and .NET, fulfilling the one .NET dream.