Following from Retrieving NuGet package programatically using NuGet.exe classes (not command line), here is the script that downloads and saves the raw http responses (from the request used by the NuGet API to get them)
The scripts’s execution creates this:
Problem I had when when trying to percist the data generated from the Nuget.exe APIs (which required me to do the direct download described above)
Once we have a nice Package object in memory, it would be great if we could to just save it to disk (to persist it).
But unfortunately, XML serialization:
... Json Serialization:
....and binary serialization fail:
Since serialization doesn’t work another alternative would be to use the NuGet SharedPackageRepository object
which will create
but the object data after the save is not as rich as before
Since they are different types (ShareOptimizedZipPack is shown above on the left, and DataServicePackage on the right)
See also Offline copy of the entire NuGet.org gallery. What should I do with these 4.05 Gbs of amazing .Net Apps/APIs?