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

Add support for both WinUI 2 and 3 under Uno platform #75

Merged
merged 21 commits into from
Apr 20, 2022

Conversation

Arlodotexe
Copy link
Member

This PR introduces the ability to switch cross platform Uno heads and libraries between using WinUI 2 and 3.

  • Closes Full support for Uno Platform #28
  • Add UseUnoWinUI.ps1 - a PowerShell script to switch cross platform Uno heads and libs between Uno.UI and Uno.WinUI.
  • Cleans up - Remnants of previous attempts at this that used MSBuild
  • Consolidates Uno packages - Under a single Labs.Uno.props file.
  • Heavily tested
    • Both in Visual Studio and from the CLI with MSBuild
    • Each head under both WinUI 2 and 3
    • With the minimal required TFMs and with All TFMs
    • Single-sample solution and All solution

@Arlodotexe Arlodotexe added the enhancement Improvement to an existing feature label Apr 13, 2022
@Arlodotexe Arlodotexe self-assigned this Apr 13, 2022
@Arlodotexe Arlodotexe changed the title Add support for both WinUI 2 and 3 under Uno platforms Add support for both WinUI 2 and 3 under Uno platform Apr 13, 2022
@Arlodotexe
Copy link
Member Author

@michael-hawker We should resync on what we want the Build Validation pipelines to look like with these changes.

  • Building under both WinUI 2 and 3 for Uno as part of the All solution build validation?
  • Possibly splitting WinUI 2 / 3 into their own build pipelines for faster and cleaner validation when something is wrong?

@michael-hawker
Copy link
Member

@Arlodotexe had put a break down in the issue here: #28 (comment)

Let's add another job to the pipeline so that in one it'll build and validate on WinUI 2 and create the WinUI 2 based packages, and then in the other it'll do the WinUI 3.

We'll need the Uno switch script to when in WinUI 2 mode to change the NuGet Package Identifier in the Experiments csproj to be .Uwp. vs. .WinUI.. If we don't change the file/assembly name, but just do it as the package identifier we shouldn't have to mess with anything else, right?

@Arlodotexe
Copy link
Member Author

Let's add another job to the pipeline so that in one it'll build and validate on WinUI 2 and create the WinUI 2 based packages, and then in the other it'll do the WinUI 3.

So we'd effectively just copy the existing pipeline, but add in the WinUI 3 switch for Uno?

We'll need the Uno switch script to when in WinUI 2 mode to change the NuGet Package Identifier in the Experiments csproj to be .Uwp. vs. .WinUI.

I'll do some tinkering and see about importing that part of the PackageId as part of the Uno props file.

@Arlodotexe
Copy link
Member Author

Implemented and tested outputting different packages with different PackageId for WinUI 2 / 3

image

Copy link
Member

@michael-hawker michael-hawker left a comment

Choose a reason for hiding this comment

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

Looking good. How does this work for the UWP/WinAppSDK heads in the Experiment projects? Do they just still work by default?

common/Scripts/UseUnoWinUI.ps1 Show resolved Hide resolved
@Arlodotexe
Copy link
Member Author

Arlodotexe commented Apr 14, 2022

Looking good. How does this work for the UWP/WinAppSDK heads in the Experiment projects? Do they just still work by default?

Yep, this is just for Uno. Both WinAppSDK and UWP should continue to work whether Uno is using WinUI 2 or 3, both in the IDE and in the nupkg since they're under different TargetFrameworks.

@michael-hawker
Copy link
Member

Everything passed in the Action, so not sure why it's stuck...?

image

Maybe we'll see on another pass later with the next change?

Like the individual commit is showing green:

image

@michael-hawker
Copy link
Member

Ah, yes, it's waiting on the status of the pipeline called build because of this setting:

image

We'll have to update this.

Copy link
Member

@michael-hawker michael-hawker left a comment

Choose a reason for hiding this comment

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

Couldn't get the experiment to run the WASM head in WinUI 3 mode, just was blank page after Uno logo. Worked fine in default WinUI 2 mode though (as did the UWP/WinAppSDK heads).

common/Scripts/UseUnoWinUI.ps1 Show resolved Hide resolved
@michael-hawker
Copy link
Member

michael-hawker commented Apr 15, 2022

ah, just tried to change branches and got this:

image

Would that be the difference with the other flag you mentioned @Arlodotexe?

Doing a git reset --hard did change that file back in the present form though, and then let me switch branches.

@michael-hawker michael-hawker added this to In progress in Labs Launch Apr 18, 2022
@@ -8,10 +8,11 @@ Param (
)
Copy link
Member

Choose a reason for hiding this comment

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

Is the PowerShell guidelines for naming convention be uppercase for like AllowGitChanges so the flag is -AllowGitChanges on the commandline?

@michael-hawker
Copy link
Member

michael-hawker commented Apr 20, 2022

@Arlodotexe mind turning the verbose on the uno check so we can get more details?

Edit: nvm, realized I could do it. Just wanted more info as it looked green.

@michael-hawker
Copy link
Member

Confirmed this is a transient issue due to a Google url with Uno Check.

@michael-hawker
Copy link
Member

Arlo confirmed that the WASM WinUI things work in a separate app, so we'll commit this and then fix forward with tracking issue #77 as we default to the working WinUI 2 versions for now.

@michael-hawker michael-hawker merged commit 6ed4315 into main Apr 20, 2022
Labs Launch automation moved this from In progress to Done Apr 20, 2022
@delete-merged-branch delete-merged-branch bot deleted the feature/winui-2-and-3 branch April 20, 2022 19:04
Martin1994 pushed a commit to Martin1994/Labs-Windows that referenced this pull request Sep 2, 2023
…winui-2-and-3

Add support for both WinUI 2 and 3 under Uno platform
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Improvement to an existing feature
Projects
Development

Successfully merging this pull request may close these issues.

Full support for Uno Platform
2 participants