Set Up Your .NET MAUI Development Environment
This guide will walk you through the essential steps to set up your development machine for building cross-platform applications with .NET MAUI.
Step 1: Install Visual Studio
The easiest way to get started with .NET MAUI is by installing Visual Studio. We recommend using the latest stable version.
- Visual Studio 2022: Download and install Visual Studio 2022. During the installation, ensure you select the ".NET Multi-platform App UI development" workload. This workload includes all the necessary SDKs, targets, and components for .NET MAUI development.
If you are on macOS, you can install Visual Studio for Mac, which also supports .NET MAUI development.
For detailed installation instructions and prerequisites, please refer to the official Visual Studio documentation.
Step 2: Install .NET SDK
.NET MAUI runs on the .NET platform. You need to have a compatible .NET SDK installed.
When you select the ".NET Multi-platform App UI development" workload in Visual Studio Installer, it typically installs the correct .NET SDK version. However, you can also download and install it separately from the official .NET website.
Verify your installation by opening a command prompt or terminal and running:
dotnet --version
This should output the installed .NET SDK version.
Note on SDK Versions
Always ensure you are using an SDK version that is compatible with the .NET MAUI version you intend to use. Check the .NET MAUI release notes for specific SDK version requirements.
Step 3: Configure Target Platforms
.NET MAUI allows you to build apps for multiple platforms. You'll need to install the necessary SDKs and tools for each platform you target.
Android Development
If you plan to develop for Android:
- The Visual Studio workload will install the Android SDK.
- You can optionally install Android emulators for testing or use a physical Android device.
iOS Development (macOS Required)
If you plan to develop for iOS (and macOS):
- You must use Visual Studio for Mac.
- Xcode is required for iOS development. Ensure you have the latest version installed from the Mac App Store.
- Pair your Mac with Visual Studio on Windows if you are developing on Windows and targeting iOS.
Windows Development
For Windows development:
- Windows 10 (version 1903 or later) or Windows 11 is required.
- The Windows App SDK is installed as part of the MAUI workload.
macOS Development
For macOS development:
- macOS 10.15.7 or later is required.
- The .NET MAUI workload in Visual Studio for Mac handles the necessary installations.
Tip: Use the Visual Studio Installer
The Visual Studio Installer is your central hub for managing workloads and individual components. It's highly recommended to use it for all installations and updates related to .NET MAUI development.
Step 4: Create Your First .NET MAUI App
Once your environment is set up, you're ready to create your first .NET MAUI application.
- Open Visual Studio.
- Select "Create a new project".
- Search for ".NET MAUI App".
- Choose the "MAUI App" template and click "Next".
- Configure your project name, location, and solution name.
- Click "Create".
Visual Studio will generate a basic .NET MAUI project. You can then select your target platform (e.g., Android emulator, Windows machine) and run the application.
Troubleshooting Common Issues
If you encounter issues, consider the following:
- Ensure all updates are applied: Check for updates for Visual Studio, .NET SDK, and any platform-specific SDKs.
- Clean and Rebuild: Sometimes, a simple clean and rebuild of your project can resolve build errors.
- Check Path Variables: Ensure that your environment variables are correctly set, especially the PATH variable for the .NET SDK.
- Consult the Official Documentation: The official .NET MAUI installation guide is an excellent resource for detailed troubleshooting steps.