Deploying Packages to NuGet Hosted Repositories
In order to authenticate a client against a NuGet repository, NuGet uses an API key for deployment requests. The API key acts as an alias for the user account, so the same API key is used for all NuGet repositories within the repository manager. This user-specific key is generated separately by a user and can be regenerated at any time. At regeneration, all previous keys generated for that user are invalidated.
Accessing your NuGet API Key
For usage with the repository manager, NuGet API keys are only needed when packages are going to be deployed. Users with the necessary nx-apikey-all security privilege can access the NuGet API Key feature view via the User menu by pressing on their username in the main toolbar.
You can access your NuGet API key by pressing on the Access API Key button and providing password. The resulting user interface context is displayed in Figure: “Accessing your NuGet API Key”. It shows the key as well as the full command line to register the key for usage with nuget
.
The Reset API Key button can be used to invalidate an existing API key and create a new one.
Figure: Accessing your NuGet API Key
Note
Usage of the API key requires the NuGet API-Key Realmto be activated. To do this, simply add the realm to the active realms in the Realmsfeature of the Security menu from the Administrationmenu. General details are available in Realms.
Command line based Deployment to a NuGet Hosted Repository
The nuget
command line tool allows you to deploy packages to a repository with the push command. The command requires you to use the NuGet API Key and the URL of the target hosted repository. For example, you could push to the default hosted repository using the URL http://localhost:8081/repository/nuget-hosted
.
Using the delete command of nuget allows you to remove packages in a similar fashion. Further information about the command line tool is available in the online help.