Events
Mar 17, 9 PM - Mar 21, 10 AM
Join the meetup series to build scalable AI solutions based on real-world use cases with fellow developers and experts.
Register nowThis browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
The focus of .NET MAUI in .NET 8 is quality. In .NET 8, 1618 pull requests were merged that closed 689 issues. These includes changes from the .NET MAUI team as well as the .NET MAUI community. These changes should result in a significant increase in quality in .NET 8.
Important
Due to working with underlying external dependencies, such as Xcode or Android SDK Tools, the .NET Multi-platform App UI (.NET MAUI) support policy differs from the .NET and .NET Core support policy. For more information, see .NET MAUI support policy.
In .NET 8, .NET MAUI ships as a .NET workload and multiple NuGet packages. The advantage of this approach is that it enables you to easily pin your projects to specific versions, while also enabling you to easily preview unreleased or experimental builds. When you create a new .NET MAUI project the required NuGet packages are automatically added to the project.
This article lists the new features of .NET MAUI for .NET 8 and provides links to more detailed information on each.
For information about what's new in .NET 8, see What's new in .NET 8.
While the focus of this release of .NET MAUI is quality, there's also some new functionality that enables new scenarios in your apps.
Grid.Add
overload that accepts 5 arguments has been added back to .NET MAUI. However, this method is deprecated and is only present to aid migrations from Xamarin.Forms.PlatformArgs
property. This property provides access to the platform-specific arguments for a drag or drop event. For more information, see Recognize a drag and drop gesture.x:ClassModifier
attribute can be specified on XAML classes, to control the access level for a generated class in an assembly. For more information, see Class modifiers.AppThemeBinding
with the DynamicResource
markup extension. For more information, see Define and consume theme resources.ContentProperty
of the SolidColorBrush class, and therefore does not need to be explicitly set from XAML.App
class. For more information, see Decouple window management from the App class.MauiUIApplicationDelegate
gains a PerformFetch
method that can be overridden or consumed via the iOSLifecycle.PerformFetch
delegate. For more information, see iOS and Mac Catalyst platform lifecycle events.The following types or members have been deprecated:
AutomationProperties.Name
, AutomationProperties.HelpText
, and AutomationProperties.LabeledBy
attached properties have been deprecated.The following types or members have been removed:
Application.Properties
property and Application.SavePropertiesAsync
method have been removed. To migrate your app properties data to .NET MAUI, see Migrate data from the Xamarin.Forms app properties dictionary to .NET MAUI preferences.PhoneDialer.Current
property has been removed. Use PhoneDialer.Default
instead.OpenGLView
has been removed.The following behavior has changed from the previous release:
xmlns
namespace declaration: xmlns:maps="http://schemas.microsoft.com/dotnet/2021/maui/maps"
.ImageSource.FromStream
method. This is due to the lack of data from which to create a reasonable cache key.KeyboardAutoManagerScroll.Disconnect
method, in the Microsoft.Maui.Platform
namespace, can be called to disable this default behavior. The KeyboardAutoManagerScroll.Connect
method can be called to re-enable the behavior after it's been disabled.$(ApplicationIdGuid)
build property in your app's project file. This is because .NET MAUI Windows apps no longer require a GUID as an app ID, and instead use the value of the $(ApplicationId)
build property as the app ID. Therefore, the same reverse domain format app ID is now used across all platforms, such as com.mycompany.myapp.PlatformImage.FromStream
method, in the Microsoft.Maui.Graphics
namespace, can now be used to load images on Windows instead of having to use the W2DImageLoadingService
class.There are plenty of performance changes in .NET MAUI 8. These changes can be classified into five areas:
IEquatable
in .NET MAUI{AppThemeBinding}
CA1307
and CA1309
for performanceCA1311
for performanceViewAttachedToWindow
event on AndroidSystem.Reflection
for {Binding}
StringComparer.Ordinal
for Dictionary
and HashSet
MauiDrawable
on AndroidLabel
on AndroidEntry.MaxLength
on AndroidCollectionView
on WindowsUnmanagedCallersOnlyAttribute
on Apple platformsXamarin.AndroidX.Legacy.Support.V4
System.Linq.Expressions
implementation on iOS-like platformsDynamicCodeSupport=false
for iOS and CatalystFor more information, see .NET 8 Performance Improvements in .NET MAUI.
To upgrade your projects from .NET 7 to .NET 8, install .NET 8 and the .NET MAUI workload with Visual Studio 17.8+, or with the standalone installer and the dotnet workload install maui
command.
Then, open your .csproj file and change the Target Framework Monikers (TFMs) from 7 to 8. If you're using a TFM such as net7.0-ios13.6
be sure to match the platform version or remove it entirely. The following example shows the TFMs for a .NET 7 project:
<TargetFrameworks>net7.0-android;net7.0-ios;net7.0-maccatalyst;net7.0-tizen</TargetFrameworks>
<TargetFrameworks Condition="$([MSBuild]::IsOSPlatform('windows'))">$(TargetFrameworks);net7.0-windows10.0.19041.0</TargetFrameworks>
The following example shows the TFMs for a .NET 8 project:
<TargetFrameworks>net8.0-android;net8.0-ios;net8.0-maccatalyst;net8.0-tizen</TargetFrameworks>
<TargetFrameworks Condition="$([MSBuild]::IsOSPlatform('windows'))">$(TargetFrameworks);net8.0-windows10.0.19041.0</TargetFrameworks>
Explicit package references should also be added to your .csproj file for the following .NET MAUI NuGet packages:
<ItemGroup>
<PackageReference Include="Microsoft.Maui.Controls" Version="$(MauiVersion)" />
<PackageReference Include="Microsoft.Maui.Controls.Compatibility" Version="$(MauiVersion)" />
</ItemGroup>
The $(MauiVersion)
variable is referenced from the version of .NET MAUI you've installed. You can override this by adding the $(MauiVersion)
build property to your .csproj file:
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net8.0-android;net8.0-ios;net8.0-maccatalyst</TargetFrameworks>
<UseMaui>True</UseMaui>
<MauiVersion>8.0.3</MauiVersion>
</PropertyGroup>
</Project>
This can be useful when using ad-hoc builds from the nightly feed or builds downloaded from pull requests.
In addition, the $(ApplicationIdGuid)
build property can be removed from your .csproj file in .NET 8. For more information, see Behavior changes.
Prior to building your upgraded app for the first time, delete the bin
and obj
folders.
Note
The project template for a .NET MAUI app in .NET 8 enables the nullable context for the project with the $(Nullable)
build property. For more information, see Nullable.
.NET MAUI feedback
.NET MAUI is an open source project. Select a link to provide feedback:
Events
Mar 17, 9 PM - Mar 21, 10 AM
Join the meetup series to build scalable AI solutions based on real-world use cases with fellow developers and experts.
Register nowTraining
Learning path
Build mobile and desktop apps with .NET MAUI - Training
In this learning path, use C# and Visual Studio with .NET MAUI to create an app that runs across iOS, Android, and Windows.