Repository navigation
Description
What would you like to be added? 💡
Make the Windows (WinAppSDK) head of a single-project app build when its XAML uses LottieVisualSource, without the app having to discover that CommunityToolkit.WinUI.Lottie is needed there.
Since the Lottie Uno Feature was removed in 7.0 (cc5a349), Uno.Sdk ignores Lottie in UnoFeatures (Uno.Features.targets#L14-L16) and nothing adds a Lottie package on the Windows TFM. The same XAML builds on the Uno heads and fails on the Windows head with an error that doesn't mention the missing package.
Options (any of these would do):
- Add
CommunityToolkit.WinUI.Lottie(with a manifest version) to the WinAppSDK head whenLottieis listed inUnoFeatures, i.e. keep the token meaningful on that one head. - Emit a build warning/error on the WinAppSDK head when
Lottieis listed but the package isn't referenced. - At minimum, call it out in the 7.0 release guidance and in the
AnimatedVisualPlayer/Lottiedocs next to "no package is needed".
Why is this needed? 🤔
Guidance for 7.0 says Lottie needs no package ("AnimatedVisualPlayer, LottieVisualSource and ThemableLottieVisualSource are part of Uno.WinUI... so no package is needed on Uno Platform targets"). The doc does mention a Windows exception further down, but a default unoapp multi-head project has a Windows TFM, so following the "no package" message gives an app that works on desktop/WASM/mobile and breaks the Windows head with:
MainPage.xaml(12,73): XamlCompiler error WMC0001: Unknown type 'LottieVisualSource' in XML namespace 'using:CommunityToolkit.WinUI.Lottie'
This is not a regression from 6.x: 6.7 also did not add CommunityToolkit.WinUI.Lottie on the WinAppSDK head (the Lottie feature only added SkiaSharp.Views.WinUI there). It is a gap that the 7.0 change made more visible, because the feature that used to be the place to hook this is now gone.
How to reproduce
Confirmed by a real build with Uno.Sdk 7.0.0-dev.75 (latest public dev build when tested), .NET SDK 10.0.401.
global.json:{ "msbuild-sdks": { "Uno.Sdk": "7.0.0-dev.75" } }.csproj(single project):<Project Sdk="Uno.Sdk"> <PropertyGroup> <TargetFrameworks>net10.0-desktop;net10.0-windows10.0.26100</TargetFrameworks> <OutputType>Exe</OutputType> <UnoSingleProject>true</UnoSingleProject> <UnoFeatures>SkiaRenderer;Lottie;</UnoFeatures> </PropertyGroup> </Project>
MainPage.xaml:<Page ... xmlns:lottie="using:CommunityToolkit.WinUI.Lottie"> <AnimatedVisualPlayer Width="100" Height="100" AutoPlay="True"> <lottie:LottieVisualSource UriSource="ms-appx:///Assets/a.json" /> </AnimatedVisualPlayer> </Page>
dotnet build -f net10.0-desktopsucceeds (and the app starts).dotnet build -f net10.0-windows10.0.26100 -c Releasefails with WMC0001 above. (A Debug build of the Windows head currently fails earlier with a different, already reported error: Debug build of the WinAppSDK head fails with MSB4057: target "_UnoAddLibraryAssets" does not exist (Uno.UI.HotDesign.props) #24983.)
Workaround
<ItemGroup>
<PackageReference Include="CommunityToolkit.WinUI.Lottie" Condition="$(TargetFramework.Contains('windows'))" />
</ItemGroup>plus <PackageVersion Include="CommunityToolkit.WinUI.Lottie" Version="8.2.250604" /> in Directory.Packages.props. With that, dotnet build -f net10.0-windows10.0.26100 -c Release succeeds (verified). Or drop the Windows TFM.
Works on UWP/WinUI
On Windows App SDK the type comes from CommunityToolkit.WinUI.Lottie, which has to be referenced explicitly.
Environment
Uno.Sdk 7.0.0-dev.75, .NET SDK 10.0.401, net10.0-windows10.0.26100. Code references are at master 4393a80.
Anything else we need to know? 💬
project.assets.jsonof the Windows TFM contains no Lottie package.- Docs on master already say "On Windows (WinAppSDK), reference the
CommunityToolkit.WinUI.LottieNuGet package" (Lottie.md), so the behavior is documented; the issue is discoverability from the single-project experience. - The change would be small for option 1 or 2: Uno.Implicit.Packages.ProjectSystem.WinAppSdk.targets plus the Sdk package manifest; but it needs a decision on whether the removed feature token should mean something on the Windows head.
Activity
fix(sdk): Report Lottie XAML on WinAppSDK without its package
fix(sdk): Report Lottie XAML on WinAppSDK without its package