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

Accommodate WinUI 2/3 dependencies per-experiment #132

Closed
Arlodotexe opened this issue May 24, 2022 · 3 comments · Fixed by #139
Closed

Accommodate WinUI 2/3 dependencies per-experiment #132

Arlodotexe opened this issue May 24, 2022 · 3 comments · Fixed by #139
Assignees
Labels
dev loop ➰ For issues that impact the core dev-loop of building experiments enhancement Improvement to an existing feature

Comments

@Arlodotexe
Copy link
Member

Arlodotexe commented May 24, 2022

Background

So far, Labs is set up to work with

  • UWP - WinUI 2 (Windows)
  • WinAppSDK - WinUI 3 (Windows)
  • Uno Platform (WinUI 2 AND 3, all other platforms)

The problem

While devs can easily add nuget packages to the library code for their experiment, it's not currently possible to add nuget packages that work under Uno and accommodate both WinUI 2 and 3.

The cause

Under everything except UWP and WinAppSDK, the projects share a target framework between WinUI 2 and 3.

Possible solutions

We fixed this for labs itself in #75 by using a powershell script. The script UseUnoWinUI.ps1 modified the Labs.Uno.props file to switch between the WinUI 2 and WinUI 3 versions of the Uno packages, then suppresses git changes to prevent the user from changing the default for everyone else.

Doing this exact same setup for experiment dependencies would quickly get a mess due to the user changing the file + git suppressing changes.

Instead, we should try something like this:

    Experiment.Lib.csproj
              | Imports
              v
         Deps.props                   - Swap WinUI 2/3 import via pwsh, suppress git changes
              | 
             /\
           /    \
          |      | Imports
          v      v
WinUI2.props    WinUI3.props          - Allow user to freely modify

Then, in the UseUnoWinUI.ps1 script, in addition to modifying Labs.Uno.props, it would check each experiment and modify the Deps.props file to swap between importing WinUI2.props and WinUI3.props.

The ProjectTemplate will need to be adjusted for this, as well as all existing experiments.

Final note - pick better file names than the provided ones. They're shortened to fit in the graphic.

@Arlodotexe Arlodotexe added enhancement Improvement to an existing feature dev loop ➰ For issues that impact the core dev-loop of building experiments labels May 24, 2022
@michael-hawker
Copy link
Member

Would these specific props files be part of each experiment or something we have all-up? As ideally, only each experiment's packages include whatever dependencies they need to work.

We also have to account for differences across Uno for both sides as well, no?

I do like the idea that we have two places to specify UWP + Uno dependencies vs. WinUI 3 + Uno dependencies and handle swapping that with the other script (as that's what controls that and in the CI).

As once it's setup a developer shouldn't have to worry about it.

I just want to make sure we make it accessible and straight-forward for folks to understand where they need to add dependencies and how (as their instinct is going to be right-click on the experiment library and 'manage nuget packages').

@Arlodotexe
Copy link
Member Author

Arlodotexe commented May 24, 2022

Would these specific props files be part of each experiment or something we have all-up? As ideally, only each experiment's packages include whatever dependencies they need to work.

These props files would be part of each experiment.

We also have to account for differences across Uno for both sides as well, no?

I'm not sure I understand the question.

I just want to make sure we make it accessible and straight-forward for folks to understand where they need to add dependencies and how (as their instinct is going to be right-click on the experiment library and 'manage nuget packages').

The Nuget Package Manager should work just fine for most cases. Dealing with the props files should only happen when you need to add an Uno-compatible UI library. Something to point out in docs, similar to how Uno does for the Community Toolkit.

@Arlodotexe Arlodotexe self-assigned this May 24, 2022
@michael-hawker
Copy link
Member

Related to #24 as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dev loop ➰ For issues that impact the core dev-loop of building experiments enhancement Improvement to an existing feature
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants