Maui.Markup icon indicating copy to clipboard operation
Maui.Markup copied to clipboard

Added source link

Open pictos opened this issue 1 year ago • 10 comments

Description of Change

This PR will add the Source Link to our package.

Before (1.0.1 on nuget.org): image

After (This PR): image

As you can see the Source Link is green, and we have the Repository information now.

Linked Issues

  • Related to #92

PR Checklist

  • [x] Has a linked Issue, and the Issue has been approved(bug) or Championed (feature/proposal)
  • [ ] Has tests (if omitted, state reason in description)
  • [ ] Has samples (if omitted, state reason in description)
  • [x] Rebased on top of main at time of PR
  • [x] Changes adhere to coding standard
  • [ ] Documentation created or updated: https://github.com/MicrosoftDocs/CommunityToolkit/pulls/XYZ

Additional information

pictos avatar Jul 25 '22 23:07 pictos

Hey @pictos! Could you follow up on the CI build errors?

It's happening on both Windows + macOS. I'm also able to reproduce it locally.

error NU5017: Cannot create a package that has no dependencies nor content. [/Users/bramin/GitHub/CommunityToolkit.Maui.Markup/src/CommunityToolkit.Maui.Markup/CommunityToolkit.Maui.Markup.csproj]

brminnick avatar Aug 05 '22 18:08 brminnick

@brminnick what's the command that you're using? I tried on my end and everything works on both VS 2022 preview 6 and terminal

image

pictos avatar Aug 05 '22 23:08 pictos

Also, from the logs

 Successfully created package '/Users/runner/work/1/a/nuget/CommunityToolkit.Maui.Markup.1.0.0-preview1348.nupkg'.
/Users/runner/hostedtoolcache/dotnet/sdk/6.0.302/Sdks/NuGet.Build.Tasks.Pack/build/NuGet.Build.Tasks.Pack.targets(221,5): error NU5017: Cannot create a package that has no dependencies nor content. [/Users/runner/work/1/s/src/CommunityToolkit.Maui.Markup/CommunityToolkit.Maui.Markup.csproj]

looks like the package was created and then an error happens.

pictos avatar Aug 05 '22 23:08 pictos

I'm able to reproduce it using the same command in the CI Pipeline:

https://github.com/CommunityToolkit/Maui.Markup/blob/10916e1eeaf6ea92b5bd90c83013e3e9ecf3b26b/azure-pipelines.yml#L240

brminnick avatar Aug 05 '22 23:08 brminnick

@brminnick I took the time to investigate this issue, and I would say it's something to do with NuGet or the package... And has to do with the version number parameter, like on our YAML on MCT we don't specify the output path, as you can see here

script: 'dotnet pack $(PathToCommunityToolkitCoreCsproj) -c Release -p:PackageVersion=$(NugetPackageVersion)'

Locally on my mac, I tried this command and it works.

dotnet pack -c Release -p:PackageVersion=1.2.3.4 --output obj/nuget -p:IncludeSymbols=true -p:SymbolPackageFormat=snupkg

Do think that makes sense to use the same pattern as we use for MCT? Looking in the www I found this StackOverflow post that could have something to do with it. It says this error is caused by a folder that starts with . (not sure if it's our case)

pictos avatar Aug 12 '22 21:08 pictos

Thanks Pedro! Let's double-check with @VladislavAntonyuk and @jfversluis who are more familiar with the NuGet part of this CI/CD process.

Vlad/Gerald - what do you think? Can we edit this dotnet pack step?

brminnick avatar Aug 12 '22 21:08 brminnick

We need to remove it from macOS build and move to Windows build. The output path which is currently specified is used by NuGet publish task. This task exists only in Windows job.

VladislavAntonyuk avatar Aug 13 '22 04:08 VladislavAntonyuk

Interesting. It seems to create the nupkg but not the snupkg package. The only thing I can think of is that the pdb files are not created in the pipeline and therefore not picked up when creating the snupkg file resulting in an empty package?

But I also can't reproduce this locally. Maybe some bugged .NET version we're using in the pipeline but not locally?

Edit: on the MCT repo we use version 6.0.300 to build and pack while here we use 6.0.x, so that seems to support my theory on the difference in .NET versions.

jfversluis avatar Aug 17 '22 09:08 jfversluis

Hey @pictos! I figured out that the error was actually a bug that is fixed in .NET 7.0.

I updated our Azure Pipelines YAML file, adding .NET 7.0.x to the CI pipeline before running dotnet pack:

  1. Install .NET 6 SDK
  2. Install .NET MAUI
    • Uses the .NET 6 SDK to install .NET MAUI which ensures we have a stable (non-preview) .NET MAUI build
  3. Build CommunityToolkit.Maui.Markup.Sample
  4. Build CommunityToolkit.Maui.Markup + CommunityToolkit.Maui.Maurkup.UnitTests
  5. Run Unit Tests
  6. Install .NET 7 SDK
    • Used only by dotnet pack
  7. Pack NuGet Package

We're still using .NET 6 to build our DLLs, so our output isn't really impacted by installing this preview of .NET 7.

I also downloaded and tested the NuGet package asset from this CI build and it works fine in my .NET MAUI apps: Screen Shot 2022-08-31 at 6 17 45 PM

brminnick avatar Sep 01 '22 01:09 brminnick

Dang - never mind.

Doing this causes the .NET MAUI Dependencies to appear: Screen Shot 2022-08-31 at 6 42 09 PM

I'll revert the CI/CD changes

brminnick avatar Sep 01 '22 01:09 brminnick

image

https://github.com/dotnet/sourcelink

brminnick avatar Nov 17 '23 17:11 brminnick