I'd like to get loud warnings somewhere if my project is using a dependency that's now out of date (potentially I might hook this into our build, so builds using certain outdated dependencies are automatically failed and can't be deployed).
If possible I'd like to do this for dependencies on our other internal projects only, to start with, so that if I publish a new version of a shared internal library, all other projects using that library are loudly notified/required to update to the new one, but so we don't have to immediately upgrade to the newest version of entity framework every time it's upgraded.
Is there a way to easily check whether all or a subset of my NuGet dependencies are up to date from the package manager console, or with an MSBuild task?
You can get a list of all your installed packages and the latest version on NuGet.
I created a PowerShell script to do this. You can find it here:
Nuget, compare installed vs latest version
An alternative is to suscribe to the RSS feed found in the package webpage at nuget.org, at the bottom of the page.
If desired it's possible to manually query the public API for NuGet to retrieve package information. They have a newer JSON api which i was able to use in a NodeJS app, and they have an older XML api.
https://api.nuget.org/v3/index.json
All versions of a package: https://api.nuget.org/v3/registration0/newtonsoft.json/index.json
Specific package at version: https://api.nuget.org/v3/registration0/newtonsoft.json/4.0.1.json
(keep in mind that the package ID in the URL must be all lowercased!)
https://nuget.org/api/v2/
All Packages (paged -first 100): https://www.nuget.org/api/v2/Packages
Next page of 100: https://www.nuget.org/api/v2/Packages?$skip=100
Specific package at version: https://www.nuget.org/api/v2/Packages(Id='NewtonSoft.Json',Version='4.0.1')
With the XML version I don't know of a way to list all versions of a package, but when you visit the versioned package there is a boolean value for <d:IsLatestVersion>
and <d:IsAbsoluteLatestVersion>
(I'm not sure what the difference is though... perhaps one exclude pre-release versions?)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With