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

Use slngen and remove UWP target from WinUI packages #350

Merged

Conversation

michael-hawker
Copy link
Member

@michael-hawker michael-hawker commented Jan 9, 2023

Fixes dotnet/runtime#262
Fixes dotnet/runtime#257

With this change UWP developers will have to use the CommunityToolkit.Labs.Uwp.* packages and WindowsAppSDK developers will need to use CommunityToolkit.Labs.WinUI packages (as we've been communicating already, so no change there).

We thought we may be able to ease transition by including both by still including UWP bits in the WinUI packages, but dotnet/runtime#262 may indicate that breaks when building a Packaged Windows App SDK Desktop project.

This PR removes the UWP bits from the WinUI NuGet packages (they remain of course in the UWP NuGet packages).

It also:

Before:
image
After (-detailed will show parameter help):
image

  • And of course, conditionally selects the set of platforms to build for in the CI based on if running the UWP or WinUI package job

Opening this draft PR to test while we await more info on expected behaviors from the platform team.

@michael-hawker
Copy link
Member Author

Write the UWP test head...

D:\a\Labs-Windows\Labs-Windows\tests\CommunityToolkit.Labs.Tests.Uwp\CommunityToolkit.Labs.Tests.Uwp.csproj : error NU1605: Detected package downgrade: System.Reflection from 4.3.0 to 4.1.0. Reference the package directly from the project to select a different version.  [D:\a\Labs-Windows\Labs-Windows\Toolkit.Labs.All.sln]
D:\a\Labs-Windows\Labs-Windows\tests\CommunityToolkit.Labs.Tests.Uwp\CommunityToolkit.Labs.Tests.Uwp.csproj : error NU1605:  CommunityToolkit.Labs.Tests.Uwp -> Microsoft.NET.Test.Sdk 16.11.0 -> System.Runtime.InteropServices.RuntimeInformation 4.0.0 -> System.Resources.ResourceManager 4.0.1 -> runtime.aot.System.Resources.ResourceManager 4.3.0 -> System.Reflection (>= 4.3.0)  [D:\a\Labs-Windows\Labs-Windows\Toolkit.Labs.All.sln]

We wouldn't need to build or run those tests on the WinUI 3 build anymore (they're run on WinUI 2 one anyway).

🤔

@michael-hawker
Copy link
Member Author

Hope this time works. VS may want to prompt to save sln file, so need to investigate later or clean-up this approach if we end up doing this... Just trying to get bits to see if resolve issue at first at least...

… packages

Adds a 'all-uwp' target to UseTargetFrameworks.ps1
Adds better documentation to UseTargetFrameworks.ps1
Conditionally selects the set of platforms to build for in the CI based on if running the UWP or WinUI package job
…olution

Removes calling UseUnoWinUI script from GenerateAllSolution as we call that separately on the CI anyway
Tested generated solution still loads in VS 2022 without issue
Simplified step for running tests
@michael-hawker
Copy link
Member Author

Using this to test out and validate changes for dotnet/runtime#257 as well now.

@michael-hawker
Copy link
Member Author

@Arlodotexe very weird, looks like rollForward didn't work on linux, as updating the version in the global.json worked fine... @jeromelaban any ideas why that may have been?

It clearly worked on Windows:

image

Wonder if it could be something like this issue? dotnet/sdk#13799

Will comment there and see.

@michael-hawker michael-hawker marked this pull request as ready for review January 27, 2023 20:36
@michael-hawker michael-hawker changed the title 🚧 Potential Fix for #262 - Remove UWP target from WinUI packages Fix for #262 - Use slngen and remove UWP target from WinUI packages Jan 27, 2023
@michael-hawker michael-hawker changed the title Fix for #262 - Use slngen and remove UWP target from WinUI packages Use slngen and remove UWP target from WinUI packages Jan 27, 2023
@michael-hawker
Copy link
Member Author

Updated PR description, think we're basically ready to go. Everything looks good in the CI.

@michael-hawker
Copy link
Member Author

Checked everything still working with Codespaces as well. Haven't heard back on platform thread, will follow-up on Monday, but think we can move forward still as we know this resolves the issue.

@jeromelaban
Copy link
Collaborator

@Arlodotexe very weird, looks like rollForward didn't work on linux, as updating the version in the global.json worked fine... @jeromelaban any ideas why that may have been?

It does not ring a bell, no. It's been generally reliable for me, are you still having an issue?

@michael-hawker
Copy link
Member Author

@jeromelaban saw it as an issue, added all of what I saw in a comment here: dotnet/sdk#13799 (comment)

(Looks like slngen has updated for ARM64, will push an update to the PR to check-out.)

@michael-hawker
Copy link
Member Author

michael-hawker commented Jan 30, 2023

@Arlodotexe slngen was just updated, so this PR should be all set without further work.

Discussed with @azchohfi too that we only need ARM64 support and shouldn't need ARM.

Copy link
Member

@Arlodotexe Arlodotexe left a comment

Choose a reason for hiding this comment

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

Tested locally and everything works as expected. Before closing, we should remove the common/Toolkit.Labs.All.sln.template file since it's no longer being used.

@michael-hawker
Copy link
Member Author

Thanks @Arlodotexe, good catch! Have pushed a commit to remove the file. Will make sure everything runs clean again and then merge.

@michael-hawker
Copy link
Member Author

Well now I'm extra confused... it says the .NET SDK is installed, but then it can't find it???

image

@jeromelaban think I should open an issue on the https://github.com/actions/runner-images repo for this? I don't really understand why it's failing to find the SDK in one tool, when the install tool finds it fine... Any ideas? Like it just ran fine in the previous commit 4601457, and nothing that effects it should have changed.

@michael-hawker
Copy link
Member Author

Um... the WinUI 3 build failed with the same issue... what???

image

@michael-hawker
Copy link
Member Author

michael-hawker commented Feb 2, 2023

As far as we can tell when this occurs it doesn't seem to be hitting slngen, or if it is, it's before any of their logging is occuring.

The -d flag to dotnet also doesn't seem to provide any extra information.

Explicitly listed the sdks again, and we can clearly see it's just confused:

image

Which makes no sense. Not sure where to follow-up from here. Also, not sure why this just happened to start occurring in the last day or so, as we did have clean builds before.

It seems to consistently fails on Linux in the CI (Ubuntu), but works in Codespaces (Debian).

It seems intermittent on if it fails on Windows...

@michael-hawker
Copy link
Member Author

So, pretty sure this issue is specific to the dotnet tool and how it handles global.json.

I removed our global.json pin:

{
  "sdk": {
    "version": "6.0.405",
    "rollForward": "latestFeature"
  },

And then it picked up the .NET 7 install and ran fine.

I added it back, but without the rollForward parameter:

{
  "sdk": {
    "version": "6.0.405"
  },

And then it properly picked up the request and installed 6.0.405 version of .NET...

So, it seems like rollForward is just broken?

@michael-hawker
Copy link
Member Author

Filed dotnet/sdk#30361 but think it's related to not using tool run explicitly when calling slngen. Will clean-up in morning and get us back to where we were with the PR when it was ready to merge, with new fix. And hopefully we should be good? Very bizarre. FYI @jeromelaban, we were using tool run for our other tools, but could see this be a general issue, as far as we saw the tool was never run, so should be a general problem, but hopefully an easy workaround?

@Arlodotexe Arlodotexe merged commit 6b2f89e into CommunityToolkit:main Feb 3, 2023
Martin1994 pushed a commit to Martin1994/Labs-Windows that referenced this pull request Sep 2, 2023
…ui-package-fix

Use slngen and remove UWP target from WinUI packages
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants