Create a NuGet Repository
Create a NuGet Repository
To install (or publish) NuGet packages, creation of a NuGet repository is required. Check out Nexus Repository Management and Repository Types to learn more.
NuGet Proxy Repository
Use Nexus proxy repository when you want to download packages and centralize package caching of external dependencies. To learn more, check Proxy Repositories.
To create a new Swift proxy repository, take the following steps:
- Navigate to Settings → Repository→ Repositories.
- Select the Create repository button.
- From the list of Recipes, select nuget (proxy).
- In the form that appears, complete the required fields.
- Repository Name, for example nuget-proxy
- Remote storage URL
- NuGet v3: https://api.nuget.org/v3/index.json
- Chocolatey Community Repository: https://community.chocolatey.org/api/v2/
- NuGet v2: https://www.nuget.org/api/v2/
- Blob store
- Enter the Symbol Server URL to proxy Symbol downloads. Requests to
/symbols/{filename}/{hash}/{filename}that miss the local cache are forwarded to this URL and the response is cached locally for subsequent requests.- Public NuGet.org symbol server: https://symbols.nuget.org/download/symbols
- Microsoft public symbol server: https://msdl.microsoft.com/download/symbols
- Select the Allow Anonymous Symbol Access checkbox (enabled by default) to bypass the standard authentication check. This is a required field for most .NET debuggers as they do not send authentication headers on symbol requests. Uncheck this only if you have arranged for your clients to authenticate to the SymSrv endpoint.
- Complete the additional fields for configurations you wish to add for creating your repository. Available configurations differ by repository format and type. See Configurable Repository Fields and Format Specific Configurations for more details.
- Select Create repository.
Note
- The remote NuGet service index URL (for example https://api.nuget.org/v3/index.json) is not used as a symbol source. Symbol servers are a separate host from NuGet package feeds. You must set Symbol Server URL explicitly if you want the proxy to fetch symbols from upstream.
- Cached symbol files are subject to the repository's Content Maximum Age setting. Symbol files older than this threshold are considered stale and revalidated against the upstream symbol server on the next request using a conditional
GET. Set Content Max Age to-1to cache symbol files indefinitely. This is appropriate for content-addressed PDB files that never change at a given GUID + age signature. - The Invalidate Cache action (available from the repository list or Administration → System → Tasks) also clears the symbol proxy cache, causing all locally cached symbol files to be revalidated against upstream on the next request.
The repository protocol must be compatible with the upstream feed. Chocolatey Community Repository uses a NuGet v2 endpoint.
NuGet Hosted Repository
Use Nexus hosted repository when you want to publish and store your own internal artifacts and third party components, so they can be consumed via Nexus. To learn more, check Hosted Repositories.
To create a new NuGet hosted repository, take the following steps:
- Navigate to Settings → Repository → Repositories.
- Select the Create repository button.
- From the list of Recipes, select nuget (hosted).
- In the form that appears, complete the required fields.
- Repository Name, for example nuget-hosted
- Blob store
- Complete the additional fields for configurations you wish to add for creating your repository. Available configurations differ by repository format and type. See Configurable Repository Fields for more details.
- Select Create repository.
NuGet Group Repository
Use Nexus group repository when you want to combine multiple other repositories (proxy, hosted, and other groups) and expose them through a single URL. To learn more, check Group Repositories.
To create a new NuGet group repository, take the following steps:
- Navigate to Settings → Repository → Repositories.
- Select the Create repository button.
- From the list of Recipes, select nuget (group).
- In the form that appears, complete the required fields.
- Repository Name, for example nuget-group
- Blob store
- Member repositories in the desired order
- Complete the additional fields for configurations you wish to add for creating your repository. Available configurations differ by repository format and type. See Configurable Repository Fields for more details.
- Select Create repository.
Best Practices
- To have a standard NuGet v3 group repository, add only the NuGet v3 proxy repositories to it. Environments with a mix of V2 and V3 endpoints default to using the V2 protocol.
- For Chocolatey clients, use a NuGet v2 proxy repository that points to the Chocolatey Community Repository
/api/v2/. Chocolatey can search packages through a NuGet v3 feed, but package installation requires the NuGet v2 endpoint. - Use Nexus group repositories to get the V3 API support for NuGet. For more details, see Microsoft documentation.
Migrate NuGet v2 to NuGet v3 Repositories
NuGet.org had updated its package service to version 3 to provide performance improvements over its legacy version 2 (OData-based) service. Nexus Repository continues to provide limited support for the V2 endpoint, though it is not recommended.
To retain packages from your version 2 proxy repository, use the Export and Import tasks to move them to a hosted repository.
No migration is needed for hosted repositories. NuGet-hosted repositories support both NuGet v2 and v3 protocols.
For NuGet group repositories, create a new NuGet 3 group repository and include only V3 proxy repositories.