2

I have a test harness, in which I would like to verify the version number of a nuget package automatically.

I have been searching for a good while trying to find a way to get the latest version number (not the latest package) for a given package. But no luck.

Is there a way to get the latest version number of a package via an API? (Needs to be automatable).

If it matters, I am using ProGet for my NuGet repository.

Vaccano
  • 78,325
  • 149
  • 468
  • 850

1 Answers1

1

This url template will get you the package info (in XML) of the latest version. You will then have to parse out the LatestVersion or AbosluteLatestVersion:

$"https://{yourNuGetRepositoryBaseUrl}/nuget/{feedName}/Packages()?$filter=Id%20eq%20%27{packageId}%27%20and%20IsLatestVersion&$top=1"

Note that this works with ProGet (that has many different feeds). You could probably omit the FeedName part to use it with NuGet.org.

Vaccano
  • 78,325
  • 149
  • 468
  • 850