JetBrains Space Help

Publish NuGet Packages

Suppose you have a NuGet package and want to publish it to the newly created NuGet feed by:

Upload NuGet packages

The fastest way to publish a NuGet package is to directly upload it to a NuGet feed.

  1. Open the Packages page and select the required NuGet feed.

  2. Click the Upload package Upload button in the top right corner.

  3. Follow the instructions in the window.

Publish NuGet packages using command-line tools

The easiest way to publish a NuGet package to a feed is to run a one-line dotnet nuget push, nuget push or choco push command. The feed's URL and credentials should be provided as command arguments.

To publish NuGet packages using the dotnet tool

  • Typically, you should specify package name, the feed's URL, and a permanent access token. For example:

    dotnet nuget push MyPackage.0.0.1.nupkg -s https://nuget.pkg.jetbrains.space/mycompany/p/projectkey/mynuget/v2/package -k access-token-goes-here

To publish NuGet packages using the nuget tool

  • Typically, you should specify package name, the feed's URL, and a permanent access token. For example:

    nuget push MyPackage.0.0.1.nupkg -Source https://nuget.pkg.jetbrains.space/mycompany/p/projectkey/mynuget/v2/package -ApiKey access-token-goes-here

To publish NuGet packages using the Chocolatey tool

  • Typically, you should specify the package name, the feed's URL, and a permanent access token. For example:

    choco push MyPackage.0.0.1.nupkg -s https://nuget.pkg.jetbrains.space/mycompany/p/projectkey/mynuget/v2/package -k access-token-goes-here

Configure access to a NuGet feed from a local machine

If you don't want to provide credentials or an access token each time you access the feed, you can configure permanent access to the feed. There are several ways to do this:

To configure access to a NuGet feed using the dotnet tool

  • You should provide feed URL and access credentials using the dotnet nuget add source command. For example:

    dotnet nuget add source https://nuget.pkg.jetbrains.space/mycompany/p/projectkey/mynuget/v3/index.json -n myNuget -u admin -p access-token-goes-here --store-password-in-clear-text

To configure access to a NuGet feed using the nuget tool

  • You should provide feed URL and access credentials using the nuget sources add command. For example:

    nuget sources add -name foo.bar -source https://nuget.pkg.jetbrains.space/mycompany/p/projectkey/mynuget/v3/index.json -username admin -password access-token-goes-here

To configure access to a NuGet feed using the Chocolatey tool

  • You should provide the feed URL and access credentials using the choco source add command. For example:

    choco source add -name foo.bar -s https://nuget.pkg.jetbrains.space/mycompany/p/projectkey/mynuget/v3/index.json -u admin -p access-token-goes-here

To configure access to a NuGet feed using NuGet settings

  1. Open the NuGet configuration file. By default, it's located at

    • Windows: %appdata%\NuGet\NuGet.Config

    • macOS/Linux: ~/.config/NuGet/NuGet.Config or ~/.nuget/NuGet/NuGet.Config

  2. In the packageSources section, specify the feed's URL.

  3. In the packageSourceCredentials section, specify credentials of either your own Space account (we recommend that you use a permanent token instead of a password) or a separate service account.

  4. The resulting configuration will look similar to the following one:

    <configuration> <packageSources> <add key="space" value="https://nuget.pkg.jetbrains.space/mycompany/p/projectkey/mynuget/v3/index.json" protocolVersion="3"/> </packageSources> <packageSourceCredentials> <space> <add key="Username" value="admin"/> <add key="ClearTextPassword" value="access-token-goes-here"/> </space> </packageSourceCredentials> </configuration>

Alternatively, you can use Azure Artifacts Credential Provider. What this tool does is acquire and securely store a token any time you access a NuGet package from the feed.

To configure access to a NuGet feed using Azure Artifacts Credential Provider

  1. Install the tool by downloading and running the helper script: installcredprovider.ps1 (Windows) or installcredprovider.sh (macOs, Linux).

  2. Provide feed credentials. Here you have two options:

    • Save the credentials in environment variables.

    • Perform any operation that requires authorization. For example, run dotnet restore --interactive in the project directory or nuget restore. The acquired token will be saved in the session token cache location.

    For more information, refer to the tool documentation.

Once you set up the access to the feed, you can publish packages without specifying feed access credentials. For example:

dotnet nuget push MyPackage.0.0.1.nupkg https://nuget.pkg.jetbrains.space/mycompany/p/projectkey/mynuget/v3/index.json
nuget push MyPackage.0.0.1.nupkg -Source https://nuget.pkg.jetbrains.space/mycompany/p/projectkey/mynuget/v3/index.json -ApiKey key

nuget pushApiKeykeyApiKey

nuget setapikey key -Source https://nuget.pkg.jetbrains.space/mycompany/p/projectkey/mynuget/v3/index.json
choco push MyPackage.0.0.1.nupkg -s https://nuget.pkg.jetbrains.space/mycompany/p/projectkey/mynuget/v3/index.json -k key

oco pushApiKeykkeyApiKey

choco apikey add -s https://nuget.pkg.jetbrains.space/mycompany/p/projectkey/mynuget/v3/index.json -k key

Publish NuGet packages from JetBrains TeamCity

For example, you have a TeamCity build configuration that builds a library and creates a NuGet package. Now, your task is to publish the package to a NuGet feed in Space Packages.

  1. Add the NuGet feed to your build configuration. To do this:

    TeamCity. Add NuGet feed credentials
  2. When adding a build step that should work with the feed, for example NuGet Publish, specify the feed's URL. TeamCity will automatically take credentials from the Nuget feed credentials feature.

    TeamCity. NuGet Publish
Last modified: 05 June 2023