Bintray is a fully-fledged NuGet repository and works seamlessly both with the NuGet client and with Visual Studio. Both the NuGet client and Visual Studio can resolve packages from or deploy them to Bintray.
|To get code snippets formulated for your specific username and repository, use the Set Me Up button.|
Configuring the NuGet Client
To configure the NuGet client to work with Bintray you will need to add Bintray and your repository to the list of sources as follows:
nuget sources Add -Name Bintray -Source https://api.bintray.com/nuget/<USERNAME>/<REPOSITORY_NAME> -UserName <USERNAME> -Password <API KEY>
To enable the use of your NuGet API key, execute the following command:
nuget setapikey <USERNAME>:<APIKEY> -Source Bintray
Configuring Visual Studio
To configure the NuGet Visual Studio Extension to use Bintray, you need to add Bintray as another Package as follows:
Under the Tools | Options menu, select NuGet Package Manager | Package Sources and add a new Package Source:
Name: Bintray NuGet Repository (for example)
Source: Copy and paste the snippet below:
|Make sure you have enabled the new source by setting its checkbox in the list of available sources.|
Distributing files via Bintray includes three steps: creating a version, uploading the files and publishing the files as follows:
Creating a Version: Uploaded files are associated with a specific version of a package. In some cases, the upload process creates the version automatically; in other cases you need to create a target version through the Bintray UI or using the REST API.
Uploading: You can upload (or deploy) your files using cURL as described below. After uploading your files, the files have a status of "un-published". This means that in the Bintray UI, they are only visible to you and can only be downloaded with your username and API Key. While your uploaded files are still "un-published", you can still discard them before anyone sees or downloads them. The Bintray UI indicates files that are un-published and provides links to publish or discard them.
Publishing: Once you are ready to expose your uploaded files, you can publish them and make them visible and available to all Bintray users. Files can be published via the Bintray UI, or via the REST API, both as part of the upload, or separately. In some cases, uploading the files publishes them automatically, so you can skip this step.
Deploying with the NuGet Client
Once you have set up your NuGet API key, you can deploy packages using the NuGet client as follows:
nuget push <PACKAGE_NAME> -Source https://api.bintray.com/nuget/<USERNAME>/<REPOSITORY_NAME>
Deploying with cURL
The cURL command to upload NuGet packages is as follows:
curl -T <FILE.EXT> -u<USERNAME>:<API_KEY> https://api.bintray.com/content/<USERNAME>/<REPOSITORY_NAME>/<PACKAGE_NAME>/<VERSION_NAME>/<FILE_TARGET_PATH>
Once your NuGet package is uploaded, Bintray automatically calculates the repository-wide NuGet metadata.