-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Upgrading .NET MAUI from .NET 7 to .NET 8
David Ortinau edited this page Oct 5, 2023
·
5 revisions
To upgrade from .NET 7 to 8:
- Install .NET 8 and the .NET MAUI workload with Visual Studio 17.8+, or with the standalone installer and
dotnet workload install maui
command. - Change your target framework references from
net7.0-*
tonet8.0-*
We recommend also adding explicit package references to .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 have installed. You may override this by adding <MauiVersion></MauiVersion>
to the csproj like this:
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net8.0-android;net8.0-ios</TargetFrameworks>
<UseMaui>True</UseMaui>
<MauiVersion>8.0.0-preview.6.23329.7</MauiVersion>
...
This is useful when using ad-hoc builds from the Nightly Feed or builds downloaded from pull requests.