NuGet API call to get the latest version number of a package - api

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.

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.

Related

Publish Elm19 package, which first version was published as 18 package at a time Elm19 was already out

Some time after the release of Elm19 I published a library, which I needed for an Elm18 code base: thought2/elm-wikimedia-commons.
This worked well, it's listed in the community driven Elm18 package database: https://dmy.github.io/elm-0.18-packages/, can be installed and all good. Except the fact that the documentation is not shown in the package details, but that I heard is a known bug there. (But still I think this is very bad)
But the main problem is now, how to migrate the library to Elm 19: The actual migration steps are done and live in the master branch of the repo: http://github.com/thought2/elm-wikimedia-commons
The Elm18 versions proceeded to 1.1.0 in the meanwhile and after the migration there had to be done an API change, so I'd assume the latest version to become 2.0.0. If I add this to elm.json, the command elm publish tells me that this would be the first version and I should change this. Which is not right.
After a bit of research, I found out that the package (among other 18 ones that have been published in the same time period) is not listed in this json: https://package.elm-lang.org/all-packages This should contain all packages regardless of versions.
Any ideas what to do? This is really blocking my development, as I'm stuck in both lands now: 18 and 19. Would appreciate a lot if someone has some hints or solutions for me!
You shouldn't need to mess with the version number specified in elm.json.
If you set it back to the version of the package that is already published and run elm bump the elm program will look at the changes you've made to the package's API and set the new version accordingly.
Looking at https://github.com/thought2/elm-wikimedia-commons it doesn't look like any of your upgrade changes were breaking changes to your package API so the version won't be a 2.x.x, it will be a 1.x.x.
You'll need to remove the 2.0.0 git tag as well and instead add a tag for the version that elm bump tells you that your package is.

Dotnet CLI: How to know the latest version value is actual on the current day?

From Microsoft documentation (here):
How to know the latest version value is actual on the current day?
You can look up the package using Nuget.org, see here. I'm not sure if it's possible to add a version reference that always resolves to the latest available version, as the Nuget dependency manager tries to resolve to the lowest applicable package available.

NPM download count by package version?

I know there's a public API for getting NPM download counts, as well as tools built on top of it like npm-stat and npmtrends. However, I'd like to get more granular and see downloads for a particular package by version. I don't see this documented in the API docs anywhere. Is it possible?
Per version download counts are now available from the npm registry.
Download count for specific versions of a package are only available for the previous 7 days. They have a unique API end point
GET https://api.npmjs.org/versions/{package}/last-week
Note: for scoped packages, the / needs to be percent encoded. (#slack/client -> #slack%2Fclient).
They're also displayed in the Versions tab of the package's home page.

What is the correct package to use for SIgnalR with ASP.NET Core?

I'm trying to use SignalR in an ASP.NET Core web application but I'm struggling to find the correct package to use. In this article, they say to use "Microsoft.AspNetCore.SignalR" (with the help of a NuGet.Config file) but when I do a dotnet restore, I get:
error NU1102: Unable to find package Microsoft.AspNetCore.SignalR.Server with version (>= 0.2.0)
error NU1102: - Found 1 version(s) in nuget.org [ Nearest version: 0.0.1-alpha ]
error NU1102: - Found 0 version(s) in aspnetcidev
I guess the v0.0.1-alpha is not the one I want.
However, I found the package "Gray.Microsoft.AspNetCore.SignalR.Server" and it seems to work but the last published version is from November 2016... That, and the namespace make me think that it's not the package I have to use neither...
I also saw this video that refers to the v1.0.0 version but, of course, I can get it to work...
Anyway, what is the correct package to use in order to use SignalR?
I'm using the prerelease dev package for now.
https://dotnet.myget.org/F/aspnetcore-ci-dev/api/v3/index.json (thank you Pawel)
I also had to get the Microsoft.Extensions.Primitives from there.
Update:
I had to go back to .NET core 1.1 packages since migrating to 2.0 will not work for several reasons. I went back to using the unmaintained Microsoft.AspNetCore.SignalR.Server Version 0.1.0 from here:
https://www.myget.org/F/aspnetmaster/api/v3/index.json
Update:
For a new project I'm successfully using the v.1.0.0-alpha2-final version from nugget.org.
Examples including the JavaScript files can be found here: aspnet/SignalR-samples

Best way to ensure latest F# FAKE?

What is the best way to ensure that all developers and the build server are using the latest version of FAKE?
If a build.cmd like the one from FSharp.Data is used, the developer will not be on the latest until they delete FAKE from the packages folder or just delete the whole packages folder.
If you add FAKE as a dependency in .nuget\packages.config, your build.fsx script must include the version information and be updated each time you change versions. You will not automatically get the latest version.
With NuGet 2.8.1 you can remove the "if not exists" parts - NuGet will check (very slowly) if the latest FAKE is installed.