0

(Ed. Note: This is not related to this question, which asks about a different kind of source repository. It may be related to this question, but I am trying to differentiate.)

Background/ Challenge

I am attempting to use the NuGet client SDK to programmatically work my way back from a package found on a machine to its source repository.

I am using the NuGet Client SDK, and I am able to pull package metadata. However, the source repository URL does not seem to be present in the metadata (only a project URL is present, and that is for a different URL).

Is there a way to get to this information without downloading a parsing the nuspec for the latest version, as indicated in this SO question?

The NUnit project package on NuGet, with a link that says "Source repository" and a git icon highlighted.

SeanKilleen
  • 8,809
  • 17
  • 80
  • 133

1 Answers1

0

If you've already got the package on the machine there's no need to re-download it - you can find the package in your global cache (C:\Users\<user>\.nuget\packages) and parse the value out of the nuspec from there

rbennett485
  • 1,907
  • 15
  • 24
  • Thanks, but in this specific situation that's not what I'm looking to do. I'm curious whether the information is available from an API call or via the client SDK without accessing a nuspec file, or whether I do have to get to the file itself (via either the file on disk or via the API call.) – SeanKilleen Oct 22 '21 at 17:22