At my place of employment we have a temperamental proxy server which often makes the nuget packages window unusable (the same is true for the nuget command line). I've started copying the packages we use most often to a local mirror on a network share, but doing this manually has become tedious. I've experimented with using powershell to download the packages automatically, but can't seem to get the odata uri to show more than a few packages. For example running the following query:
$feed = [xml]$webClient.DownloadString("http://feed.nuget.org/ctp2/odata/v1/Packages?$filter=startswith(Title,'O') eq true&$top=100")
Should return the top 100 packages that have a title beginning with 'O', but no packages are returned. Weirdly this works fine with package names that are in the default list of packages returned by hitting http://feed.nuget.org/ctp2/odata/v1/Packages
. I'm guessing that there's some kind of paging going on, where I'm only querying over the first page. Playing with the parameters I don't seem to be able to change to the next page...
Has anyone else tried to do this? Has anyone else noticed timeouts/bad requests using nuget?
The location of the service index for nuget.org is https://api.nuget.org/v3/index.json .
The default is %userprofile%\. nuget\packages (Windows) or ~/. nuget/packages (Mac/Linux). A relative path can be used in project-specific nuget.
Set up Visual StudioIn Visual Studio, select Tools, and then select Options. Select NuGet Package Manager, and then select Package Sources. Enter the feed's Name and Source URL, and then select the green (+) sign to add a new package source. If you enabled upstream sources in your feed, clear the nuget.org checkbox.
Jon Galloway posted a PS script that downloads the whole repository. I've used it on a couple of machines and it works great for me.
http://weblogs.asp.net/jongalloway/downloading-a-local-nuget-repository-with-powershell
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