Bewerken

Delen via


Build Windows apps with .NET MAUI

.NET Multi-platform App UI (.NET MAUI) is a cross-platform framework for creating native mobile and desktop apps with C# and optionally XAML. Using .NET MAUI, you can develop apps that can run on Windows, Android, iOS, macOS, and Samsung Tizen from a single shared code-base. If you build a Windows app with .NET MAUI, it will use WinUI 3 as its native platform, and therefore run on Windows 10 version 1809 or later and Windows 11.

Why use .NET MAUI on Windows?

Building apps for Windows with .NET MAUI provides several benefits:

  • Native on Windows: .NET MAUI creates a WinUI app when targeting Windows. This means that your .NET MAUI app will provide the same user experience on Windows as your Windows App SDK applications.
  • User interface in code: The .NET MAUI Community Toolkit includes C# Markup, a set of fluent helper methods for building user interfaces in C# code. This enables a separation of concerns between the UI and the business logic of your app, just as with XAML. C# Markup is available on all platforms supported by .NET MAUI.
  • Cross-platform: Take your Windows apps to all supported platforms, including Android, iOS, macOS, and Samsung Tizen devices.
  • Simplicity: Develop in a single shared project that can target every platform supported by .NET MAUI.
  • Hot Reload: Save time while debugging with .NET Hot Reload and XAML Hot Reload support in .NET MAUI. Make edits while the app is running and the changes are automatically applied.
  • Native APIs: .NET MAUI provides cross-platform APIs for native features on each platform. For native APIs that are not available in .NET MAUI's cross-platform APIs, you can invoke platform-specific code.

If you are planning to build a new app for Windows and want to target additional platforms, you should consider using .NET MAUI. If you are only targeting Windows with your app, there are some good reasons to continue using the Windows App SDK:

  • Familiarity: .NET MAUI XAML and Windows App SDK XAML have some differences. If you are comfortable with XAML in UWP and Windows App SDK, you will have a bit of a learning curve with the .NET MAUI controls and XAML syntax.
  • Native Controls: .NET MAUI does not currently support using Windows App SDK controls. If you have existing controls from other Windows App SDK projects you intend to re-use or rely on 3rd Party or open source controls, you will need to find alternatives for .NET MAUI projects.
  • Closer to Windows: When writing .NET MAUI apps, it outputs a Windows App SDK app, but there is some translation to get from your code to the native Windows app. With Windows App SDK, you are eliminating that translation step and are less likely to encounter issues with styles, API compatibility, or layout.

.NET MAUI resources for Windows developers

.NET MAUI documentation

The .NET MAUI docs include resources for learning about .NET MAUI development for every platform, including Windows.

WinUI documentation

Explore the WinUI docs to learn about the features of WinUI.

.NET Conf: Focus on MAUI

This one-day live stream from August 2022 featured speakers from Microsoft and the .NET MAUI developer community. Learn how to build apps and hear from the team building .NET MAUI.

.NET MAUI blog posts

GitHub

.NET MAUI is open source and hosted on GitHub. Use the .NET MAUI repository to file feature requests or bugs, interact with the development team, and explore the wiki.

Code samples

Explore the .NET MAUI code samples in the samples browser or on GitHub at dotnet/maui-samples.

Samples that demonstrate specific tasks

Sample Name/Link Task
Animations Use animations to bring your app to life.
Behaviors Add functionality without subclassing using behaviors, instead attaching behavior classes to your controls.
Control Templates Define the visual structure of ContentView derived custom controls, and ContentPage derived pages.
Data Binding Bind objects to the actual UI elements, responsively updating one another when one changes.
Shell App Use a .NET Shell app to reduce complexity, reuse code, and integrate existing Windows functionality (such as URI navigation and integrated search bars) into your app.
Triggers Use triggers to selectively update, hide, or display specific controls when an event or data changes.

Get started with .NET MAUI on Windows

To get started with .NET MAUI on Windows, install Visual Studio 2022 version 17.3 or later.

When installing or modifying Visual Studio, select the .NET Multi-platform App UI development workload with the default optional installation options selected. For more information about managing workloads in Visual Studio, see Modify Visual Studio workloads, components, and language packs. If you are using Visual Studio Code and the .NET CLI, you will use the dotnet workload command for workload management.

If you haven't enabled development mode on your PC, see Enable your device for development. If it isn't enabled, Visual Studio will prompt you to enable development mode when you try to run your first .NET MAUI project on Windows.

Next steps

Check out a walk-through of creating your first .NET MAUI app on Windows.

What is .NET MAUI

.NET MAUI supported platforms

WinUI overview

.NET MAUI Community Toolkit documentation