NuGet Hosted Repositories
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
NEW IN 3.24
The V3 API for NuGet is supported by Nexus Repository Manager NuGet Hosted repositories. Read more about the API at https://docs.microsoft.com/en-us/nuget/api/overview.
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.
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: http://localhost:8081/repository/nuget-hosted/index.json 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