Skip to main content

NuGet Hosted Repositories


Notable Compatibility Change for H2 or PostgreSQL Database Deployments

In Sonatype Nexus Repository release 3.43.0, we added compatibility with official NuGet v2 clients. The supported subset of the legacy NuGet v2 protocol is the same as that supported by Microsoft's NuGet Gallery, Use cases that rely on the deprecated parts of the v2 API are not supported, including many common Chocolatey use cases and some custom OData queries.

A hosted repository for NuGet can be used to upload your own packages as well as third-party packages. The repository manager includes a hosted NuGet repository named nuget-hosted by default.

To create another NuGet hosted repository, simply create a new nuget (hosted) repository. An example configuration from the default nuget-hosted repository is displayed in Figure: “Example Configuration for a NuGet Hosted Repository”.


Figure: Example Configuration for a NuGet Hosted Repository

The NuGet feed is immediately updated as packages are deployed or deleted from the host repository.

NuGet Hosted Version 3 Support

The V3 API for NuGet is supported by Nexus Repository Manager NuGet Hosted repositories. Read more about the API at

If you want to use hosted by V3 protocol you must add service index <nexus-host>:<nexus-port>/repository/<repository-name>/index.json as source.

For example if your Nexus Repository Manager is running on localhost:8081 and NuGet hosted repository called nuget-hosted, your service index will be available on http://localhost:8081/repository/nuget-hosted/index.json.

$ nuget source add -name nuget-v3-hosted -source http://localhost:8081/repository/nuget-hosted/index.json
Package source with Name: nuget-v3-hosted added successfully.


NuGet hosted repositories can be used as v2 and v3 at the same time. However, our v2 support implementation for PostgreSQL and H2 databases is compatible with Microsoft's NuGet Gallery, which means it does not support custom OData queries.

The following example shows installing using the v3 protocol, a package jquery which had previously been uploaded to nuget-hosted:

$ nuget install jquery -source http://localhost:8081/repository/nuget-hosted/index.json
Feeds used:

Installing package 'jquery' to '/Users/mlukaretkyi/.nuget'.
  GET http://localhost:8081/repository/nuget-hosted/v3/registration/jquery/index.json
  OK http://localhost:8081/repository/nuget-hosted/v3/registration/jquery/index.json 41ms

Attempting to gather dependency information for package 'jquery.3.4.1' with respect to project '/Users/mlukaretkyi/.nuget', targeting 'Any,Version=v0.0'
Gathering dependency information took 19.73 ms
Attempting to resolve dependencies for package 'jquery.3.4.1' with DependencyBehavior 'Lowest'
Resolving dependency information took 0 ms
Resolving actions to install package 'jquery.3.4.1'
Resolved actions to install package 'jquery.3.4.1'
Retrieving package 'jQuery 3.4.1' from 'nuget-hosted'.
  GET http://localhost:8081/repository/nuget-hosted/v3/content/jquery/3.4.1/jquery.3.4.1.nupkg
  OK http://localhost:8081/repository/nuget-hosted/v3/content/jquery/3.4.1/jquery.3.4.1.nupkg 6ms
Installing jQuery 3.4.1.
Adding package 'jQuery.3.4.1' to folder '/Users/mlukaretkyi/.nuget'
Added package 'jQuery.3.4.1' to folder '/Users/mlukaretkyi/.nuget'
Successfully installed 'jQuery 3.4.1' to /Users/mlukaretkyi/.nuget
Executing nuget actions took 131.57 ms