🌐 Documentation is currently available in English only. We're working on translations.

Home / Docs / NuGet Guide / dotnet CLI

dotnet CLI

Use the dotnet command-line interface to manage packages with NugetHosting.

⏱️ 4 min read

Add Package Source

Add NugetHosting as a NuGet package source:

dotnet nuget add source https://nuget.nugethosting.com/v3/index.json \
  --name NugetHosting \
  --username api \
  --password YOUR_API_TOKEN \
  --store-password-in-clear-text

💡 Note: Replace YOUR_API_TOKEN with your actual API token from the Tokens page.

List Package Sources

View all configured NuGet sources:

dotnet nuget list source

You should see NugetHosting in the list of registered sources.

Push Packages

If you registered the source with credentials (see above), you can push directly by name:

dotnet nuget push MyPackage.1.0.0.nupkg --source NugetHosting

Push with API Key (without registered source)

You can also push specifying the URL and API key directly:

dotnet nuget push MyPackage.1.0.0.nupkg \
  --api-key YOUR_API_TOKEN \
  --source https://nuget.nugethosting.com/v3/package

💡 Tip: To avoid passing --api-key on every push, register the source with your credentials instead (see Add Package Source above). Then you can simply use dotnet nuget push ... --source NugetHosting.

⚠️ Note: The dotnet CLI does not support setapikey. If you see "Unrecognized command or argument 'setapikey'", use --api-key inline or register the source with credentials as shown above.

Push with Symbol Package

dotnet nuget push MyPackage.1.0.0.nupkg \
  --source NugetHosting \
  --symbol-source NugetHosting

Install Packages

Add a package from NugetHosting to your project:

dotnet add package MyPrivatePackage --source NugetHosting

Or restore all packages including from NugetHosting:

dotnet restore

Remove Source

If you need to remove the source:

dotnet nuget remove source NugetHosting
Was this page helpful?