Skip to content

Getting started for MAUI development with DotNet.Meteor extension

Nikita Romanov edited this page Feb 17, 2024 · 6 revisions

Prerequisites

The latest .NET version. Please refer to the .NET installation guide if you faced any issues.

Afer installing, run the dotnet --version command in terminal to make sure that everything is installed correctly:

> dotnet --version
7.0.102

Environment Setup

Develop WinUI Applications

  1. In the Windows command line, call the following command to install the maui-windows workload:

    > dotnet workload install maui-windows
    
  2. Now you can create a MAUI application.

Develop MacOS/iOS Applications

  1. Install XCode.

  2. Install the required workload:

    • Run the following terminal command if you develop MacOS applications (mac-catalyst):
    > sudo dotnet workload install maui-maccatalyst
    
    • Run the following terminal command if you develop iOS workload:
    > sudo dotnet workload install maui-ios
    
  3. Create your MAUI application.

Develop Android Applications

  1. Install the Java Runtime Environment.
  2. Install the Android SDK. The easiest way to install it, is install the Android Studio. To install the Android SDK only, use the commandline-tools.
  3. To test your application on Android Emulator, create a Android Virtual Device (AVD).
  4. Call the following command to install a .NET MAUI Android development workload:
    • Windows
        > dotnet workload install maui-android
      
    • MacOS/Linux
       > sudo dotnet workload install maui-android
      
  5. Create your MAUI application.

Create a MAUI Application

  1. Create a folder.
  2. Navigate to that folder in terminal.
  3. Call the dotnet new maui command to create an application.
  4. Optional Step. Open the folder in VSCode and remove unnecessary platfroms from the .csproj file:
    <Project Sdk="Microsoft.NET.Sdk">
    	<PropertyGroup>
    		<!-- Remove unused platforms -->
    		<TargetFrameworks>net7.0-android;net7.0-ios</TargetFrameworks>
    		
    		...
    
    		<!-- Remove unused os versions -->
    		<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'ios'">11.0</SupportedOSPlatformVersion>
    		<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'android'">21.0</SupportedOSPlatformVersion>
    	</PropertyGroup>
  5. Optional Step. Remove unnecessary platforms from the project's Platforms folder.
  6. Sweet! Now you can run the application or customize run tasks.