Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added Uno Platform support #187

Closed
wants to merge 1 commit into from
Closed

Added Uno Platform support #187

wants to merge 1 commit into from

Conversation

xperiandri
Copy link

@xperiandri
Copy link
Author

@neuecc approve the workflow, please

@neuecc
Copy link
Member

neuecc commented Apr 5, 2024

This would make R3.WinUI3 exclusive to Uno, which is unacceptable.

@xperiandri
Copy link
Author

What do you mean by exclusive to Uno?

Comment on lines +4 to +5
<TargetFrameworks Condition="$([MSBuild]::IsOSPlatform('windows')) or '$(EnableWindowsTargeting)' == 'true'">$(TargetFrameworks);$(DotNetVersion)-windows10.0.22621</TargetFrameworks>
<TargetFrameworks>$(TargetFrameworks);$(DotNetVersion)</TargetFrameworks>
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@neuecc
You can see here that it adds net8.0;net8.0-windows10.x.xxxxx
This means that the NuGet package will have code for WinUI and for all Uno-supported platforms

@neuecc
Copy link
Member

neuecc commented Apr 5, 2024

Thank you, I understand.
I was mistaken.
However, I'm not very happy about changing the Project Sdk to Uno.Sdk or having complex conditions.

Also, I'm not very familiar with Uno, but is it okay to have only WinUI3 support it?

@xperiandri
Copy link
Author

Also, I'm not very familiar with Uno, but is it okay to have only WinUI3 support it?

No, because it makes almost no sense to build WinUI apps without targeting the other platforms that Uno provides.
Who will build a single desktop app in 2024 🙂

@xperiandri
Copy link
Author

All the project setup I used I copied from Uno project template

@xperiandri
Copy link
Author

Nothing from myself 🙂

@xperiandri
Copy link
Author

Uno.Sdk just simplifies the csproj logic

@neuecc
Copy link
Member

neuecc commented Apr 5, 2024

This PR for Uno support seems to function only in WinUI3.
For example, the Avalonia support covers all of Avalonia.
I would like a detailed and thorough explanation; otherwise, I will have to close this PR.

@xperiandri
Copy link
Author

Uno provides source compatibility on the Android, iOS, MacCatalyst, GTK (Linux/WPF), and WebAssembly platforms.
Technically it converts XAML into C# code manipulating native Android/iOS/MacCatalyst controls, renders HTML for WASM, and draws on a Skia surface for GTK.
All the WinUI ported code (API contract) is mirrored by Uno in Uno.Core.dll and Uno.UI.dll
This means that in order to target a particular Uno platform code must be compiled for that platform.
Because:

  1. WinUI compiled R3 looks for a WinUI contract in Windows.winmd and for Uno it is located in Uno.Core.dll and Uno.UI.dll
  2. C# code generated from XAML to render UI is different for each platform
    However, R3 does not generate any XAML, and point 2 is not relevant for us. That is why we do not need to target net8.0-android and others, but just net8.0 to reference the Uno.Core.dll and Uno.UI.dll to redirect API calls. In this case, WinUI targets will use net8.0-windows10.x.xxxxx but Uno targets will use common net8.0

@neuecc
Copy link
Member

neuecc commented Apr 5, 2024

I consider the current R3.WinUI to be generic support for WinUI, why doesn't Uno work with the current R3.WinUI3?
Is it because WinUI3 is now net6?

@xperiandri
Copy link
Author

No, because WinUI uses managed to native interop and generates the code that looks for Microsoft.XAML namespaces in the Windows.winmd which is a native code file with .NET like metadata.
And Uno is completely managed .NET code. It is impossible to substitute native Windows API implementation at binary level.
That is why Uno has its own .NET DLLs that implement the same contract

@xperiandri
Copy link
Author

And you cannot build WinUI for anything else than `netx.x-windows10.x.xxxxx’
As it enables that managed to native interop

@neuecc
Copy link
Member

neuecc commented Apr 5, 2024

Understood, but I don't want to continue maintaining this csproj.
If you can introduce a better and cleaner approach, I will reconsider it at that time.

@neuecc neuecc closed this Apr 5, 2024
@xperiandri
Copy link
Author

If you can introduce a better and cleaner approach

Could you define more measurable criteria?

@michaelstonis
Copy link
Contributor

Uno just released support for a single project solution in 5.2, this might be better to revisit this and see if the changes needed for Uno can be better isolated.

@xperiandri
Copy link
Author

@michaelstonis it was already 1 project here as it is a library.
I can make that csproj pretty small and look as usual.
Waiting for #188 to be approved

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants