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 PackageReferences to nuget packages #216

Closed
wants to merge 1 commit into from

Conversation

Smaug123
Copy link
Contributor

@Smaug123 Smaug123 commented Oct 5, 2024

This is an alternative phrasing of #215 . Feel free to pick either one depending on which you prefer.


I think we are currently simply missing all PackageReferences?

There's no corresponding NuGetPackageId on a PackageReference, so I've gone with simply obtaining the Include value.

The whitespace changes earlier in the file are the result of dotnet fantomas ..

@baronfel
Copy link
Collaborator

baronfel commented Oct 5, 2024

Fascinating that what we had didn't capture all of the PackageReferences - maybe we aren't targeting the right design-time target or something? This seems good to add in any case.

I'd be interested to see if SDK-inserted implicit PackageReferences (e.g. if you publish self contained for another RID) also get shown here.

@baronfel
Copy link
Collaborator

baronfel commented Oct 5, 2024

I'm ok with doing the one-pass check here too - perf is important and doing things in single-pass is an easy way to deal with it.

@Smaug123
Copy link
Contributor Author

Smaug123 commented Oct 5, 2024

If there's a chance of overlap, perhaps we might need to check for duplicates in the result 😨

@Smaug123
Copy link
Contributor Author

Smaug123 commented Oct 6, 2024

There are indeed overlaps, in the case of PackageReference Update= I believe:

[0] = {Types.PackageReference} { Name = "Nerdbank.GitVersioning"\n  Version = "3.6.143"\n  FullPath =\n   "/Users/patrick/Documents/GitHub/WoofWare.Myriad/WoofWare.Myriad.Plugins/Nerdbank.GitVersioning" }
[1] = {Types.PackageReference} { Name = "FSharp.Core"\n  Version = "6.0.1"\n  FullPath =\n   "/Users/patrick/Documents/GitHub/WoofWare.Myriad/WoofWare.Myriad.Plugins/FSharp.Core" }
[2] = {Types.PackageReference} { Name = "WoofWare.Whippet"\n  Version = "0.1.2"\n  FullPath =\n   "/Users/patrick/Documents/GitHub/WoofWare.Myriad/WoofWare.Myriad.Plugins/WoofWare.Whippet" }
[3] = {Types.PackageReference} { Name = "Fantomas.Core"\n  Version = "6.1.1"\n  FullPath =\n   "/Users/patrick/.nuget/packages/fantomas.core/6.1.1/lib/netstandard2.0/Fantomas.Core.dll" }
[4] = {Types.PackageReference} { Name = "Fantomas.FCS"\n  Version = "6.1.1"\n  FullPath =\n   "/Users/patrick/.nuget/packages/fantomas.fcs/6.1.1/lib/netstandard2.0/Fantomas.FCS.dll" }
[5] = {Types.PackageReference} { Name = "FSharp.Core"\n  Version = "6.0.1"\n  FullPath =\n   "/Users/patrick/.nuget/packages/fsharp.core/6.0.1/lib/netstandard2.1/FSharp.Core.dll" }
[6] = {Types.PackageReference} { Name = "System.Diagnostics.DiagnosticSource"\n  Version = "7.0.0"\n  FullPath =\n   "/Users/patrick/.nuget/packages/system.diagnostics.diagnosticsource/7.0.0/lib/net6.0/System.Diagnostics.DiagnosticSource.dll" }

Note the repeated FSharp.Core.
In fact this FullPath appears to be complete nonsense in the PackageReference world? I don't yet know a way to get a meaningful DLL path in that case, and that completely scuppers what I wanted to do :(

@Smaug123
Copy link
Contributor Author

Smaug123 commented Oct 6, 2024

I'm afraid I think my desired outcome ("get the path to the DLLs implied by all NuGet packages tagged with my particular custom metadata item") is beyond my current powers. The ReferencePaths appear to be the complete listing of all DLL imports, but I don't have a good way of filtering out e.g. the .NET runtime itself from those references.

@baronfel
Copy link
Collaborator

baronfel commented Oct 6, 2024

@Smaug123 how are you approaching this? Do you have a binlog that you're looking at? If so, it might be useful to look at the ResolvePackageAssets Target/Task and see if the outputs of that give you what you need. If so, we can make sure that target is in our list of design time targets so that you can grab and filter Items from that.

@Smaug123
Copy link
Contributor Author

(I've used up basically all my extracurricular energy for a while; I may eventually come back to this, but very possibly not. I solved my immediate problem using msbuild XML instead.)

@Smaug123 Smaug123 closed this Oct 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants