Book Image

.NET MAUI for C# Developers

By : Jesse Liberty, Rodrigo Juarez
3.7 (6)
Book Image

.NET MAUI for C# Developers

3.7 (6)
By: Jesse Liberty, Rodrigo Juarez

Overview of this book

While UI plays a pivotal role in retaining users in a highly competitive landscape, maintaining the same UI can be tricky if you use different languages for different platforms, leading to mismatches and un-synced pages. In this book, you'll see how .NET MAUI allows you to create a real-world application that will run natively on different platforms. By building on your C# experience, you’ll further learn to create beautiful and engaging UI using XAML, architect a solid app, and discover best practices for this Microsoft platform. The book starts with the fundamentals and quickly moves on to intermediate and advanced topics on laying out your pages, navigating between them, and adding controls to gather and display data. You’ll explore the key architectural pattern of Model-View-ViewModel: and ways to leverage it. You’ll also use xUnit and NSubstitute to create robust and reliable code. By the end of this book, you’ll be well-equipped to leverage .NET MAUI and create an API for your app to interact with a web frontend to the backend data using C#.
Table of Contents (18 chapters)
1
Part 1 – Getting Started
8
Part 2 – Intermediate Topics
12
Part 3 – Advanced Topics

Getting and installing Visual Studio

The first and foremost software you’ll need for this book is the latest version of Visual Studio from Microsoft. You can, of course, write .NET and .NET MAUI apps with any number of editors and/or Integrated Development Environments (IDEs), but Visual Studio is what I’ll be using in this book because it is, I believe, the most powerful IDE for the job. All the examples will use Visual Studio and your job will be much easier if you do so as well, at least while working your way through this book.

To get Visual Studio, open a browser and navigate to https://visualstudio.microsoft.com/. Microsoft changes the appearance of this page pretty frequently, but you should see the opportunity to download Visual Studio, Visual Studio for Mac, and Visual Studio Code.

Installing Visual Studio

On the website, click on Download Visual Studio. You can download whichever version you prefer. Note that the Community Version is free. If you already have Visual Studio 2022 or later installed, you need not add another copy, though they will run side by side assuming you have enough disk space. For installation, follow these steps:

  1. Once Visual Studio has been downloaded, click on the executable to begin the installation process. The installer will update and you will be presented with the Workloads dialog box as shown in Figure 1.1.
Figure 1.1 – Visual Studio Workloads

Figure 1.1 – Visual Studio Workloads

  1. Visual Studio lets you pick and choose what workloads you’ll need so that it is no bigger than necessary. Be sure to check Azure development, .NET Multi-platform App UI development, and .NET desktop development as shown in Figure 1.2.
Figure 1.2 – Selecting workloads

Figure 1.2 – Selecting workloads

  1. Next, click Install and get yourself a cup of coffee; this may take a few minutes. You should see progress in the Visual Studio installer, as in Figure 1.3.
Figure 1.3 – Visual Studio Installer

Figure 1.3 – Visual Studio Installer

When the installation is complete, Visual Studio will open.

A word on ReSharper

ReSharper is a very powerful tool that greatly enhances productivity for .NET developers. It is not free, however, and while I use it every day in my own work, we’ll not be using it in this book. Since we can do everything in Visual Studio without ReSharper (though it may take a few more keystrokes), no harm done.

With Visual Studio installed, the only remaining issue is storing, safeguarding, and retrieving the source code. For that, we’ll use Git – the industry standard. The final application will be in the main branch, with each chapter’s code being in a dedicated branch.