2

Nuget packages has a feature where you can add a 'Source repository' for a package

example: https://www.nuget.org/packages/Newtonsoft.Json/ has a source link embedded as "https://github.com/JamesNK/Newtonsoft.Json"

How can i display this using PowerShell or a script?

Idothisallday
  • 311
  • 1
  • 3
  • 14
  • 2
    It looks like that Find-Package and Find-Module does not return that information. Your best bet is to take a look at Nuget API reference itself here: https://learn.microsoft.com/en-us/nuget/api/overview (I did look but didn't find it in a timely manner) ... If the API does not support it, then the second best approach would be to save the package, then unzip the nuspec file then read the repository url value data. – Sage Pourpre Jan 31 '19 at 01:12

1 Answers1

0

Use the API https://api.nuget.org/v3-flatcontainer/newtonsoft.json/13.0.1/newtonsoft.json.nuspec

Under repository, look like that:

<repository type="git" url="https://github.com/JamesNK/Newtonsoft.Json" commit="ae9fe44e1323e91bcbd185ca1a14099fba7c021f"/>
Doron
  • 21
  • 7
  • The question was how to retrieve a that information from a package in PowerShell, this does not address that. – JonC Apr 30 '21 at 06:33
  • 1
    You can use the API in a script as ask... "How can i display this using PowerShell or a script?" This is how I did it... If you have a better way you are welcome to share – Doron Jun 23 '21 at 12:11