dotnet CLI
Use the dotnet command-line interface to manage packages with NugetHosting.
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 sourceYou 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 NugetHostingPush 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 NugetHostingInstall Packages
Add a package from NugetHosting to your project:
dotnet add package MyPrivatePackage --source NugetHostingOr restore all packages including from NugetHosting:
dotnet restoreRemove Source
If you need to remove the source:
dotnet nuget remove source NugetHosting