.NET Documentation

Mobile Development Setup

This guide provides step-by-step instructions to set up your development environment for building .NET mobile applications. We'll cover the essential tools and configurations required for both cross-platform and native mobile development using .NET.

Prerequisites: Ensure you have a recent version of Visual Studio installed. For .NET MAUI, Visual Studio 2022 version 17.3 or later is recommended.

1. Install .NET MAUI Workload

The .NET Multi-platform App UI (.NET MAUI) is the recommended framework for cross-platform mobile development with .NET. To get started, you need to install the MAUI workload:

Installation Steps

  1. Open Visual Studio Installer: Search for "Visual Studio Installer" in your Windows search bar and launch it.
  2. Modify Your Installation: Find your Visual Studio 2022 installation and click the "Modify" button.
  3. Select Workloads: In the "Workloads" tab, ensure that the ".NET Multi-platform App UI development" workload is checked. This will automatically select other necessary components like .NET 7.0 SDK, .NET MAUI, and C++ build tools.
    Visual Studio Installer Workloads Selection
  4. Install: Click the "Install" button to begin the installation process. This may take some time depending on your internet connection and system speed.

2. Install Development Tools for Target Platforms

Depending on your target platform (Android or iOS), you might need additional SDKs and emulators.

Android Development

The .NET MAUI workload typically includes the necessary Android SDK components. You can manage Android SDKs and AVDs (Android Virtual Devices) through the Android Device Manager in Visual Studio:

iOS Development (macOS Required)

To develop and deploy iOS applications, you need a Mac with Xcode installed. Visual Studio on Windows can connect to a Mac build host for iOS development.

3. Create Your First Mobile Project

Once the setup is complete, you can create a new .NET MAUI project:

  1. Open Visual Studio 2022.
  2. Select "Create a new project".
  3. Search for ".NET MAUI App" and select the template.
  4. Click "Next".
  5. Configure your project name and location, then click "Create".

4. Running Your Application

After creating your project, you can run it on an emulator or a connected device:

Troubleshooting: If you encounter issues, ensure your Visual Studio and workloads are up-to-date. Check the official .NET MAUI documentation for more detailed troubleshooting guides.

Alternative: Xamarin Development

While .NET MAUI is the future, you might still be working with or migrating from Xamarin. The setup for Xamarin.Android and Xamarin.iOS is similar:

For older projects, you may need to ensure the specific Xamarin workloads are installed via the Visual Studio Installer.

Next Steps