fix: use Uno 5.2 for MauiEmbedding Sample

This commit is contained in:
Dan Siegel 2024-04-16 17:15:11 -06:00
Родитель e89d6050b5
Коммит c19353546f
9 изменённых файлов: 50 добавлений и 31 удалений

Просмотреть файл

@ -1,4 +1,6 @@
<Project>
<Import Project="../../src/maui-embedding.props" />
<PropertyGroup>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>

Просмотреть файл

@ -1,13 +1,13 @@
<Project ToolsVersion="15.0">
<ItemGroup>
<PackageVersion Include="CommunityToolkit.Mvvm" Version="8.2.0" />
<PackageVersion Include="CommunityToolkit.Mvvm" Version="8.2.2" />
<PackageVersion Include="Microsoft.Extensions.Logging.Console" Version="8.0.0" />
<PackageVersion Include="Microsoft.Windows.SDK.BuildTools" Version="10.0.22621.3233" />
<PackageVersion Include="Microsoft.WindowsAppSDK" Version="1.5.240311000" />
<PackageVersion Include="SkiaSharp" Version="2.88.7" />
<PackageVersion Include="SkiaSharp.Views.Uno.WinUI" Version="2.88.7" />
<PackageVersion Include="SkiaSharp.NativeAssets.iOS" Version="2.88.7" />
<PackageVersion Include="SkiaSharp.Skottie" Version="2.88.7" />
<PackageVersion Include="Microsoft.WindowsAppSDK" Version="$(WinAppSdkVersion)" />
<PackageVersion Include="SkiaSharp" Version="2.88.8" />
<PackageVersion Include="SkiaSharp.Views.Uno.WinUI" Version="2.88.8" />
<PackageVersion Include="SkiaSharp.NativeAssets.iOS" Version="2.88.8" />
<PackageVersion Include="SkiaSharp.Skottie" Version="2.88.8" />
<PackageVersion Include="Uno.Core.Extensions.Logging.Singleton" Version="4.0.1" />
<PackageVersion Include="Uno.Extensions.Logging.OSLog" Version="1.7.0" />
<PackageVersion Include="Uno.Material.WinUI" Version="4.0.4" />
@ -15,18 +15,17 @@
<PackageVersion Include="Uno.Toolkit.WinUI" Version="5.0.15" />
<PackageVersion Include="Uno.Toolkit.WinUI.Material" Version="5.0.15" />
<PackageVersion Include="Uno.Resizetizer" Version="1.2.0" />
<PackageVersion Include="Uno.UI.Adapter.Microsoft.Extensions.Logging" Version="5.2.22" />
<PackageVersion Include="Uno.UI.Adapter.Microsoft.Extensions.Logging" Version="$(UnoVersion)" />
<PackageVersion Include="Uno.UniversalImageLoader" Version="1.9.36" />
<PackageVersion Include="Uno.WinUI" Version="5.2.22" />
<PackageVersion Include="Uno.WinUI.Skia.Gtk" Version="5.2.22" />
<PackageVersion Include="Uno.WinUI.RemoteControl" Version="5.2.22" />
<PackageVersion Include="CommunityToolkit.Maui" Version="2.0.0" />
<PackageVersion Include="Uno.WinUI" Version="$(UnoVersion)" />
<PackageVersion Include="Uno.WinUI.Skia.Gtk" Version="" />
<PackageVersion Include="Uno.WinUI.RemoteControl" Version="$(UnoVersion)" />
<PackageVersion Include="Telerik.UI.for.Maui" Version="5.1.0" Condition="$(_UseTelerik)" />
<PackageVersion Include="Esri.ArcGISRuntime.Maui" Version="200.1.0" />
<PackageVersion Include="Microsoft.Windows.Compatibility" Version="7.0.4" />
<PackageVersion Include="Uno.Extensions.Logging.WebAssembly.Console" Version="1.7.0" />
<PackageVersion Include="Uno.WinUI.WebAssembly" Version="5.2.22" />
<PackageVersion Include="Uno.Wasm.Bootstrap" Version="8.0.7" />
<PackageVersion Include="Uno.Wasm.Bootstrap.DevServer" Version="8.0.7" />
<PackageVersion Include="Uno.WinUI.WebAssembly" Version="$(UnoVersion)" />
<PackageVersion Include="Uno.Wasm.Bootstrap" Version="8.0.13" />
<PackageVersion Include="Uno.Wasm.Bootstrap.DevServer" Version="8.0.13" />
</ItemGroup>
</Project>

Просмотреть файл

@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net8.0;net8.0-android;net8.0-ios;net8.0-maccatalyst</TargetFrameworks>
@ -16,8 +16,8 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Maui.Controls" Version="8.0.3"/>
<PackageReference Include="Microsoft.Maui.Controls.Compatibility" Version="8.0.3"/>
<PackageReference Include="Microsoft.Maui.Controls" Version="8.0.20"/>
<PackageReference Include="Microsoft.Maui.Controls.Compatibility" Version="8.0.20"/>
<PackageReference Include="Syncfusion.Maui.Core" Version="22.2.9" />
<PackageReference Include="Syncfusion.Maui.Charts" Version="22.2.9" />
<PackageReference Include="Syncfusion.Maui.DataGrid" Version="22.2.9" />

Просмотреть файл

@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">
<!-- This is only required because this project references Uno.Extensions.Maui.WinUI as a package reference (ie by source) -->
<Import Project="..\..\..\src\Uno.Extensions.Maui.UI\build\Package.props" />
@ -37,7 +37,6 @@
<PackageReference Include="Microsoft.Extensions.Logging.Console" />
<PackageReference Include="Uno.Extensions.Logging.OSLog" />
<PackageReference Include="Telerik.UI.for.Maui" Condition="$(_UseTelerik)"/>
<PackageReference Include="CommunityToolkit.Maui" />
<PackageReference Include="Uno.UI.Adapter.Microsoft.Extensions.Logging" />
<!--<PackageReference Include="Uno.WinUI.RemoteControl" Condition="'$(Configuration)'=='Debug'" />-->
</ItemGroup>

Просмотреть файл

@ -1,4 +1,15 @@
<Project ToolsVersion="15.0">
<!--
Due to an issue with duplicate references on output for Windows we need to ensure that when building for MAUI Embedding that we use the same version
of both WinUI and Uno.WinUI across Extensions and the MauiEmbedding Sample Project.
-->
<PropertyGroup Condition="$(SolutionName) != 'MauiEmbedding'">
<UnoVersion Condition="$(UnoVersion) == '' AND !$(MSBuildProjectName.Contains('Maui'))">5.0.19</UnoVersion>
<UnoVersion Condition="$(UnoVersion) == '' AND $(MSBuildProjectName.Contains('Maui'))">5.2.22</UnoVersion>
<WinAppSdkVersion Condition="$(WinAppSdkVersion) == ''">1.4.231219000</WinAppSdkVersion>
</PropertyGroup>
<Import Project="$(MSBuildThisFileDirectory)maui-embedding.props" Condition="$(SolutionName) == 'MauiEmbedding'" />
<ItemGroup>
<PackageVersion Include="CommunityToolkit.Mvvm" Version="7.0.1" />
<PackageVersion Include="DotNet.ReproducibleBuilds" Version="1.1.1" />
@ -23,7 +34,7 @@
<PackageVersion Include="Microsoft.SourceLink.GitHub" Version="1.1.1" />
<PackageVersion Include="Microsoft.UI.Xaml" Version="2.7.1" />
<PackageVersion Include="Microsoft.Windows.SDK.BuildTools" Version="10.0.22621.756" />
<PackageVersion Include="Microsoft.WindowsAppSDK" Version="1.4.231219000" />
<PackageVersion Include="Microsoft.WindowsAppSDK" Version="$(WinAppSdkVersion)" />
<PackageVersion Include="Microsoft.Graphics.Win2D" Version="1.2.0" />
<PackageVersion Include="Moq" Version="4.17.2" />
<PackageVersion Include="Refit" Version="6.3.2" />
@ -48,16 +59,15 @@
<PackageVersion Include="Uno.Toolkit" Version="5.0.15" />
<PackageVersion Include="Uno.Toolkit.UI" Version="5.0.15" />
<PackageVersion Include="Uno.Toolkit.WinUI" Version="5.0.15" />
<PackageVersion Include="Uno.UI" Version="5.0.19" />
<PackageVersion Include="Uno.UI.Adapter.Microsoft.Extensions.Logging" Version="5.0.19"/>
<PackageVersion Include="Uno.UI.MSAL" Version="5.0.19" />
<PackageVersion Include="Uno.UI.Runtime.WebAssembly" Version="5.0.19" />
<PackageVersion Include="Uno.UI" Version="$(UnoVersion)" />
<PackageVersion Include="Uno.UI.Adapter.Microsoft.Extensions.Logging" Version="$(UnoVersion)"/>
<PackageVersion Include="Uno.UI.MSAL" Version="$(UnoVersion)" />
<PackageVersion Include="Uno.UI.Runtime.WebAssembly" Version="$(UnoVersion)" />
<PackageVersion Include="Uno.UI.RuntimeTests.Engine" Version="0.24.0-dev.95" />
<PackageVersion Include="Uno.WinUI" Version="5.0.19" Condition="!$(MSBuildProjectName.Contains('Maui'))" />
<PackageVersion Include="Uno.WinUI" Version="5.2.22" Condition="$(MSBuildProjectName.Contains('Maui'))"/>
<PackageVersion Include="Uno.WinUI" Version="$(UnoVersion)" />
<PackageVersion Include="Uno.WinUI.Markup" Version="5.2.0-dev.58" />
<PackageVersion Include="Uno.WinUI.MSAL" Version="5.0.19" />
<PackageVersion Include="Uno.WinUI.Runtime.WebAssembly" Version="5.0.19" />
<PackageVersion Include="Uno.WinUI.MSAL" Version="$(UnoVersion)" />
<PackageVersion Include="Uno.WinUI.Runtime.WebAssembly" Version="$(UnoVersion)" />
<PackageVersion Include="coverlet.collector" Version="3.1.2" />
<PackageVersion Include="xunit" Version="2.4.1" />
<PackageVersion Include="xunit.runner.visualstudio" Version="2.4.1" />

Просмотреть файл

@ -10,7 +10,9 @@ internal record ApplicationBuilder(Application App, LaunchActivatedEventArgs Arg
#if NET6_0_OR_GREATER && WINDOWS && !HAS_UNO
new Window();
#else
Window.Current;
// Window.Current can be null with Uno.WinUI 5.2+
// When updating Hosting to Uno.WinUI 5.2+ we need to remove the compiler directive
Window.Current ?? new Window();
#endif
public IHost Build()

Просмотреть файл

@ -51,7 +51,7 @@ public class ContentDialogNavigator : DialogNavigator
}
#if WINUI
dialog.XamlRoot = Window!.Content.XamlRoot;
dialog.XamlRoot = Window!.Content!.XamlRoot;
#endif
dialog.SetInstance(Region);

Просмотреть файл

@ -10,7 +10,8 @@ public static class ServiceProviderExtensions
/// <param name="services">The IServiceProvider instance to attach</param>
public async static Task<IServiceProvider> AttachServicesAsync(this Window window, IServiceProvider services)
{
return await window.Content
// NOTE: This creates a nullable error in Uno.WinUI 5.2+
return await window.Content!
.AttachServiceProvider(services)
.RegisterWindowAsync(window);
}

6
src/maui-embedding.props Normal file
Просмотреть файл

@ -0,0 +1,6 @@
<Project>
<PropertyGroup>
<UnoVersion>5.2.22</UnoVersion>
<WinAppSdkVersion>1.5.240404000</WinAppSdkVersion>
</PropertyGroup>
</Project>