Страница:
Upgrading .NET MAUI from .NET 7 to .NET 8
Страницы
.NET 7 and .NET MAUI
Blazor Desktop
CLI iOS Simulator Selection
Capturing Binary Logs
Customizing Controls with Handlers
DeviceTests
FAQs
Guidelines for Customization of Controls
Handler Property PR Guidelines
Home
Installing .NET
Known Issues
Memory Leaks
Migrating Xamarin.Forms Effects
Migrating from Preview 10 to 11
Migrating from Preview 7 to 8
Migrating from Preview 8 to 9
Migrating from Preview 9 to 10
Migrating from Xamarin.Forms (Preview)
Migrating from Xamarin.Forms to .NET MAUI
Migrating to Preview 13
Migrating to Preview 14
Migrating to RC1
News
Nightly Builds
Porting Custom Renderers to Handlers
Profiling .NET MAUI Apps
Release Versions
Roadmap
Single Project
Status
Testing
UITests
Upgrading .NET MAUI from .NET 7 to .NET 8
Using Custom Renderers in .NET MAUI
Xamarin.Forms MAUI.Controls Layout Differences
Xamarin.Forms vs .NET MAUI
5
Upgrading .NET MAUI from .NET 7 to .NET 8
David Ortinau редактировал(а) эту страницу 2023-11-16 09:18:50 -08:00
Содержание
To upgrade from .NET 7 to 8:
- First, read the release notes and What's New in .NET 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 (TFM) references from
net7.0-*
tonet8.0-*
. If you are using a TFM likenet7.0-ios13.6
, be sure to match the shipping version of that platform or just remove the platform version (i.e.13.6
). - delete your
bin
andobj
folders
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.3</MauiVersion>
...
This is useful when using ad-hoc builds from the Nightly Feed or builds downloaded from pull requests.
Misc Changes
The following behavior has changed from the previous release:
- Use of the xref:Microsoft.Maui.Controls.Maps.Map control from XAML now requires the following
xmlns
namespace declaration:xmlns:maps="http://schemas.microsoft.com/dotnet/2021/maui/maps"
. - Image caching is disabled on Android when loading an image from a stream with the
ImageSource.FromStream
method. This is due to the lack of data from which to create a reasonable cache key. - On iOS, pages automatically scroll when the soft input keyboard would cover a text entry field, so that the field is above the soft input keyboard. The
KeyboardAutoManagerScroll.Disconnect
method, in theMicrosoft.Maui.Platform
namespace, can be called to disable this default behavior. TheKeyboardAutoManagerScroll.Connect
method can be called to re-enable the behavior after it's been disabled. - How the color of a tab is set in a Shell app has changed on some platforms.
- It's not required to specify a value for the
$(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. - .NET MAUI Mac Catalyst apps are no longer limited to 50 menu items on the menu bar.
- The
PlatformImage.FromStream
method, in theMicrosoft.Maui.Graphics
namespace, can now be used to load images on Windows instead of having to use theW2DImageLoadingService
class.
General Info
- How to Contribute
- Handler Property PR Guidelines
- Official Documentation
- Roadmap
- FAQs
- Nightly Builds
- Releases