Development environment setup
Both Windows and macOS can be used for .NET MAUI development, but you won’t be able to build all targets with only one of them. You will need both Windows and Mac computers to build all targets. In this book, the Windows environment is used to build and test Android and Windows targets. iOS and macOS targets are built on a Mac computer.
.NET MAUI app can target the following platforms:
- Android 5.0 (API 21) or higher
- iOS 10 or higher
- macOS 10.13 or higher, using Mac Catalyst
- Windows 11 and Windows 10 version 1809 or higher, using Windows UI Library (WinUI) 3
.NET MAUI Blazor apps use the platform-specific WebView control, so they have the following additional requirements:
- Android 7.0 (API 24) or higher
- iOS 14 or higher
- macOS 11 or higher, using Mac Catalyst
.NET MAUI build targets of Android, iOS, macOS, and Windows can be built using Visual Studio on a Windows computer. In this environment, a networked Mac is required to build iOS and macOS targets. Xcode must be installed on the paired Mac to debug and test an iOS MAUI app in a Windows development environment.
.NET MAUI targets of Android, iOS, and macOS can be built and tested on macOS.
Target platform |
Windows |
macOS |
Windows |
Yes |
No |
Android |
Yes |
Yes |
iOS |
Yes (pair to Mac) |
Yes |
macOS |
Build only (pair to Mac) |
Yes |
Table 1.6: The development environment of .NET MAUI
Please refer to Table 1.6 to find out the build configurations on Windows and macOS.
Installing .NET MAUI on Windows
.NET MAUI can be installed as part of Visual Studio 2022. The Visual Studio Community edition is free, and we can download it from the Microsoft website at https://visualstudio.microsoft.com/vs/community/.
After launching Visual Studio Installer, we will see a screen similar to the one shown in Figure 1.3. Please select .NET Multi-platform App UI development and .NET desktop development in the list of options. We also need to select ASP.NET and web development for the .NET MAUI Blazor app, which will be covered in Part 2 of this book.
Figure 1.3: Visual Studio 2022 installation
After the installation is completed, we can check the installation from the command line using the following dotnet
command:
C:\>dotnet workload list Installed Workload Ids Manifest Version Installation Source -------------------------------------------------------------------- maui-windows 6.0.486/6.0.400 VS 17.3.32811.315 maui-maccatalyst 6.0.486/6.0.400 VS 17.3.32811.315 maccatalyst 15.4.446-ci.-release-6-0-4xx.446/6.0.400 VS 17.3.32811.315 maui-ios 6.0.486/6.0.400 VS 17.3.32811.315 ios 15.4.446-ci.-release-6-0-4xx.446/6.0.400 VS 17.3.32811.315 maui-android 6.0.486/6.0.400 VS 17.3.32811.315 android 32.0.448/6.0.400 VS 17.3.32811.315 Use `dotnet workload search` to find additional workloads to install.
We are ready to create, build, and run a .NET MAUI app on Windows.
Installing .NET MAUI on macOS
The installation of the Visual Studio Community edition is similar to what we have done on Windows. The installation package can be downloaded from the same link.
After launching Visual Studio Installer, we can see a screen similar to the one shown in Figure 1.4.
Figure 1.4: Visual Studio for Mac 2022 installation
Please select .NET and .NET MAUI from the list of options in Figure 1.4.
After the installation is completed, we can check the installation from the command line using the following dotnet
command:
% dotnet workload list Installed Workload Ids Manifest Version Installation Source -------------------------------------------------------------------- wasm-tools 6.0.9/6.0.400 SDK 6.0.400 macos 12.3.453/6.0.400 SDK 6.0.400 maui-maccatalyst 6.0.536/6.0.400 SDK 6.0.400 maui-ios 6.0.536/6.0.400 SDK 6.0.400 maui-android 6.0.536/6.0.400 SDK 6.0.400 ios 15.4.453/6.0.400 SDK 6.0.400 maccatalyst 15.4.453/6.0.400 SDK 6.0.400 maui 6.0.536/6.0.400 SDK 6.0.400 tvos 15.4.453/6.0.400 SDK 6.0.400 android 32.0.465/6.0.400 SDK 6.0.400 Use `dotnet workload search` to find additional workloads to install.
We are ready to create, build, and run a .NET MAUI app on macOS.