maui icon indicating copy to clipboard operation
maui copied to clipboard

[foldable] Package reference instead of project reference

Open conceptdev opened this issue 2 years ago • 24 comments

Reverts #5891 and converts Foldable to a package, following instructions in #5894

Description of Change

  1. Update Controls.Foldable.csproj to make NuGet
  2. Restore commented-out foldable code in the Maui.Controls.Sample project
  3. Update Maui.Controls.Sample.csproj to use a PackageReference
  4. Remove Foldable.csproj reference from Samples.slnf

Issues Fixed

#5894 where a GENERATEPROJECTPRIFILE : error : PRI175: 0x80073b0f - Processing Resources failed with error: Duplicate Entry' was being generated in the CI builds, assumed to be because the Foldable project was being referenced and bringing in all its dependencies as duplicates...

conceptdev avatar Apr 26 '22 20:04 conceptdev

/azp run

mattleibow avatar Apr 27 '22 03:04 mattleibow

Azure Pipelines successfully started running 2 pipeline(s).

azure-pipelines[bot] avatar Apr 27 '22 03:04 azure-pipelines[bot]

Latest commits build a NuGet package in the /artifacts/ folder (thanks to Microsoft.Maui.Packages.slnf), but I'm not sure the sample will be able to load it...

image

conceptdev avatar Apr 28 '22 00:04 conceptdev

/azp run

PureWeen avatar Apr 28 '22 00:04 PureWeen

Azure Pipelines successfully started running 2 pipeline(s).

azure-pipelines[bot] avatar Apr 28 '22 00:04 azure-pipelines[bot]

Current error D:\a\_work\1\s\src\Controls\samples\Controls.Sample\Maui.Controls.Sample.csproj : error NU1101: Unable to find package Microsoft.Maui.Controls.Foldable. No packages exist with this id in source(s): D:\a\_work\1\s\bin\dotnet\library-packs, darc-pub-dotnet-runtime-a21b9a2, dotnet-eng, dotnet-public, dotnet6, dotnet7, skiasharp [D:\a\_work\1\s\Microsoft.Maui.Samples.slnf]

There IS there is a Microsoft.Maui.Controls.Foldable.nupkg NuGet, but it's in D:\a\_work\1\s\artifacts\nuget and the Samples project is looking in D:\a\_work\1\s\bin\dotnet\library-packs

Need to figure out how to add another NuGet source for the sample project OR get the Foldable NuGet into the library-packs directory...

UPDATE: confirmed that manually dropping the nupkg into bin\dotnet\library-packs enables the samples build to succeed.

conceptdev avatar Apr 28 '22 03:04 conceptdev

/azp run

PureWeen avatar Apr 28 '22 21:04 PureWeen

Azure Pipelines successfully started running 2 pipeline(s).

azure-pipelines[bot] avatar Apr 28 '22 21:04 azure-pipelines[bot]

Azure Pipelines successfully started running 2 pipeline(s).

azure-pipelines[bot] avatar Apr 28 '22 23:04 azure-pipelines[bot]

Azure Pipelines successfully started running 2 pipeline(s).

azure-pipelines[bot] avatar Apr 28 '22 23:04 azure-pipelines[bot]

Azure Pipelines successfully started running 2 pipeline(s).

azure-pipelines[bot] avatar Apr 28 '22 23:04 azure-pipelines[bot]

It feels like what's happening on the server must be different to what's happening locally. Will probably roll-back these YAML changes that are trying to copy the nupkg around and revisit assumptions about what files are where 😬

The build logs show the Download Packages step successfully grabs the Foldable NuGet:

Downloaded nuget/Microsoft.Maui.Controls.Foldable.6.0.300-rc.3.7406.nupkg to D:\a\_work\1\s\artifacts\nuget\Microsoft.Maui.Controls.Foldable.6.0.300-rc.3.7406.nupkg

But the Build .NET 6 samples step isn't finding it

error NU1101: Unable to find package Microsoft.Maui.Controls.Foldable. No packages exist with this id in source(s): D:\a\_work\1\s\bin\dotnet\library-packs, darc-pub-dotnet-runtime-a21b9a2, dotnet-eng, dotnet-public, dotnet6, dotnet7, skiasharp [D:\a\_work\1\s\Microsoft.Maui.Samples.slnf]

even though the added PowerShell command seems like it should be copying it across

Move-Item -Path artifacts\nuget\*.nupkg -Destination artifacts -Force
Copy-Item -Path artifacts\*.nupkg -Destination "bin\dotnet\library-packs" -Filter *Foldable* -Force

conceptdev avatar Apr 29 '22 03:04 conceptdev

Is it in the artifact? Can you confirm in the artifact on devops or in the copy logs?

Maybe add a dir artifacts/* to a step after the download

mattleibow avatar Apr 29 '22 06:04 mattleibow

The Foldable NuGet is definitely in the nuget artifact at the end!

image

conceptdev avatar Apr 29 '22 15:04 conceptdev

I don't see the artifacts folder in here:

error NU1101: Unable to find package Microsoft.Maui.Controls.Foldable. No packages exist with this id in source(s): D:\a_work\1\s\bin\dotnet\library-packs, darc-pub-dotnet-runtime-a21b9a2, dotnet-eng, dotnet-public, dotnet6, dotnet7, skiasharp [D:\a_work\1\s\Microsoft.Maui.Samples.slnf]

I got a feeling we need an extra step in the samples to copy nuget-only packages into a folder and then add that to the samples nuget.config. This can probably be done by copying the repo's nuget.config to a temporary location and then adding the path to the new artifacts folder and then setting the RestoreConfigFile property to the path of the nuget.config: https://github.com/dotnet/maui/blob/main/eng/cake/dotnet.cake#L71

I am also thinking to prevent accidental issues, we should also make a new folder in the temp and copy the 2 foldable files in there and make the nuget.config point to that. By doing that we can make sure we get a build fail if suddenly a package is used instead of the workloads.

mattleibow avatar Apr 29 '22 19:04 mattleibow

@mattleibow yeah, that's why I was trying to copy the Foldable NuGet into bin\dotnet\library-packs, because it's already in the sources search list for the Samples project 😬

Still not sure why it wasn't working on the server, but either way it was a little hacky and your explanation/suggestion sounds more robust.

conceptdev avatar Apr 29 '22 21:04 conceptdev

After such a long time, we eventually got a bunch of things to make all this work much better.

mattleibow avatar Jul 19 '22 00:07 mattleibow

@conceptdev is this ready to be merged?

rmarinho avatar Jul 26 '22 11:07 rmarinho

I have not had a chance to test the NuGet. Will try to get it done today and approve if it works, thanks.

conceptdev avatar Jul 26 '22 16:07 conceptdev

@conceptdev did you had a chance to try it ? thanks

rmarinho avatar Aug 05 '22 10:08 rmarinho

@rmarinho I started testing this today, but needed to rebuild my VS2022 config, workloads, etc as nothing initially worked. Will finish off tomorrow and let you know how it goes.

conceptdev avatar Aug 09 '22 01:08 conceptdev

UPDATE: I was able to test the code in this branch and it still seems to work 💯 i.e. it detects the hinge when present and snaps the panes to it.

RE: Matt's warning above about generating a NuGet - I'm assuming it will be a "preview" NuGet? What release date would we be aiming for with this package? I recall when working with Shane that there might still be some edge cases we need to test/verify.

conceptdev avatar Aug 09 '22 23:08 conceptdev

Right now, it will have the same branding and version as maui itself.

So in this merge world, it probably will be released as RC 1.

mattleibow avatar Aug 09 '22 23:08 mattleibow

@mattleibow thanks for the clarification! In that case, I wonder if the PMs should chime in as this sounds like a bit of a messaging decision as well as a technical one?

FWIW here's some screenshot of the sample on dual and single screens

image

image

conceptdev avatar Aug 10 '22 18:08 conceptdev