Repository Management with Nexus

16.2. NuGet Proxy Repositories

The NuGet Gallery is the central repository used by all package authors and consumers. To reduce duplicate downloads and improve download speeds for your developers and CI severs, you should proxy the NuGet Gallery with Nexus. If you use other external repositories, you should also proxy these.

To proxy an external NuGet repository, you simply create a new Proxy Repository as documented in Section 6.2, “Managing Repositories”. The Provider has to be set to NuGet. The Remote Storage Location has to be set to the URL of the remote repository you want to proxy. The URL for the main NuGet Gallery repository is

https://www.nuget.org/api/v2/

A complete configuration for proxying the NuGet Gallery is visible in Figure 16.1, “NuGet Proxy Repository Configuration for the NuGet Gallery”.

figs/web/nuget-proxy-org.png

Figure 16.1. NuGet Proxy Repository Configuration for the NuGet Gallery


The repository configuration for a NuGet proxy repository has an additional tab titled NuGet as visible in Figure 16.2, “NuGet Gallery with Package Source URL”. It displays the Package Source URL that is URL where the repository is available as a NuGet repository.

figs/web/nuget-gallery-package-source.png

Figure 16.2. NuGet Gallery with Package Source URL


By default, searches in NuGet repositories in Nexus will be passed through to the remote repositories, and the search results are merged with internal search results and included in an internally managed index. This merging has to make some assumptions to generate component counts.

The accuracy of searches for components available in a remote repository can benefit from an index download. In most use cases, this will not be necessary. If you need a completely accurate view of available components and counts, you can create a scheduled tasks to download the remote index. Create a new task with the task type Download NuGet Feed in the Scheduled Tasks administration section.

By default the task incrementally downloads information about the latest version of published packages. If you want details about all versions, you can select the Fetch all versions? checkbox.

The NuGet Gallery is, at this stage, over 1GB large and downloading the feed will therefore take a little while. In addition, the index will be rather large and having the complete index in your Nexus NuGet database negatively impacts search performance.

[Warning]

Prior to Nexus 2.9 the scheduled task to download the feed was created automatically, since it was required then. This is no longer necessay and most users should remove the task and carefully consider the implications of running the task.