unoplatform / uno

Open-source platform for building cross-platform native Mobile, Web, Desktop and Embedded apps quickly. Create rich, C#/XAML, single-codebase apps from any IDE. Hot Reload included! 90m+ NuGet Downloads!!
https://platform.uno
Apache License 2.0
8.79k stars 707 forks source link

Make Uno.[Win]UI.<Lottie|DevServer> packages to work also on windows #14196

Open dr1rrb opened 10 months ago

dr1rrb commented 10 months ago

What would you like to be added

We should add a _._ file and remove all dependencies on windows target.

Why is this needed

Adding a reference to this packages in the core "library project" (from our app template) will break the windows build. Reference has to be conditional to NOT windows.

For which platform

No response

Anything else we need to know?

Even if our app template does include those reference conditionally to NOT windows, any dev that would add those references later in their app development (or while updating an exciting project) will encounter some weird build error:

Lottie

The windows head project build will fail with

1>MyApp.Windows.csproj : XamlCompiler error WMC1006: Cannot resolve Assembly or Windows Metadata file 'Type universe cannot resolve assembly: Uno.UI, Version=255.255.255.255, Culture=neutral, PublicKeyToken=null.'
1>C:\Users\David\.nuget\packages\microsoft.windowsappsdk\1.4.231008000\buildTransitive\Microsoft.UI.Xaml.Markup.Compiler.interop.targets(931,9): error MSB3030: Could not copy the file "obj\x64\Debug\net7.0-windows10.0.19041.0\win-x64\AppHead.xbf" because it was not found.

DevServer

When adding MainWindow.EnableHotReload();

error CS0012: The type 'Window' is defined in an assembly that is not referenced. You must add a reference to assembly 'Uno.UI, Version=255.255.255.255, Culture=neutral, PublicKeyToken=null'.
LITTOMA commented 8 months ago

Any updates on this issue? My Windows project is not built since updated to latest version of Uno.

LITTOMA commented 8 months ago

Hello?

jeromelaban commented 8 months ago

@LITTOMA Can you provide more information about your issue? It's always best to provide logs, samples, etc...

LITTOMA commented 8 months ago

@jeromelaban It's exactly the same as what @dr1rrb mention in the post. The error output for me is like:

1>MyApp.Windows.csproj : XamlCompiler error WMC1006: Cannot resolve Assembly or Windows Metadata file 'Type universe cannot resolve assembly: Uno.UI, Version=255.255.255.255, Culture=neutral, PublicKeyToken=null.'
1>C:\Users\David\.nuget\packages\microsoft.windowsappsdk\1.4.231008000\buildTransitive\Microsoft.UI.Xaml.Markup.Compiler.interop.targets(931,9): error MSB3030: Could not copy the file "obj\x64\Debug\net7.0-windows10.0.19041.0\win-x64\AppHead.xbf" because it was not found.
jeromelaban commented 8 months ago

This is unfortunately not enough to troubleshoot your issue. If you have either Uno.WinUI.Lottie or Uno.WinUI.DevServer included in your .Windows project, try removing them.

sasakrsmanovic commented 7 months ago

Hello @LITTOMA ; were you able to troubleshoot this further? We've love to action this but would love to get more information please.

LITTOMA commented 7 months ago

Hi @sasakrsmanovic . I tried to remove Uno.WinUI.Lottie package from the windows project. However another error occurs on build: WMC1006 Cannot resolve Assembly or Windows Metadata file 'Type universe cannot resolve assembly: Uno.UI, Version=255.255.255.255, Culture=neutral, PublicKeyToken=null.'

All packages I've installed:

<ItemGroup>
<PackageReference Include="Uno.Extensions.Http.WinUI" />
<PackageReference Include="Uno.WinUI" />
<PackageReference Include="Microsoft.WindowsAppSDK" />
<PackageReference Include="Microsoft.Windows.SDK.BuildTools" />
<PackageReference Include="CommunityToolkit.Mvvm" />
<PackageReference Include="Uno.Extensions.Configuration" />
<PackageReference Include="Uno.Extensions.Http" />
<PackageReference Include="Uno.Extensions.Http.Refit" />
<PackageReference Include="Uno.Extensions.Logging.WinUI" />
<PackageReference Include="Uno.Extensions.Logging.Serilog" />
<PackageReference Include="Uno.Extensions.Serialization.Http" />
<PackageReference Include="Uno.Extensions.Serialization.Refit" />
<PackageReference Include="Uno.Toolkit.WinUI" />
<PackageReference Include="Uno.Extensions.Hosting.WinUI" />
<PackageReference Include="Uno.Extensions.Localization.WinUI" />
<PackageReference Include="Uno.Extensions.Navigation.Toolkit.WinUI" />
<PackageReference Include="Uno.Extensions.Navigation.WinUI" />
<PackageReference Include="Microsoft.Extensions.Logging.Console" />
<PackageReference Include="Uno.Core.Extensions.Logging.Singleton" />
<PackageReference Include="Uno.UI.Adapter.Microsoft.Extensions.Logging" />
<PackageReference Include="System.IO.Ports" />
</ItemGroup>
jeromelaban commented 7 months ago

Thanks. Can you provide a binlog of your build? It will help troubleshoot further.