dotnet-nuget-add-source(1)

πŸ“¦
version 11.0.0~rc3 Β· 6 versions
, in alpine 3.24, centos-stream 10, centos-stream 9, fedora 43, fedora 44, nixpkgs unstable, ubuntu noble, ubuntu questing, ubuntu resolute, ubuntu stonking

✨ dotnet-nuget-add-source ✨

okay bestie, welcome to the dotnet-nuget-add-source(1) page from the .NET docs πŸ’– this one lives in the dotnet manual, and it's the glow-up guide for getting a shiny new package source into your NuGet config. no cap.

This article applies to: βœ”οΈ .NET 6 SDK and later versions


🌸 NAME 🌸

dotnet-nuget-add-source β€” add a NuGet source. that's it, that's the whole job πŸ’…

🚨 bestie listen. Use package sources that you trust. literally rule number one. no random sources, no sketchy vibes.

πŸŽ€ SYNOPSIS πŸŽ€

dotnet nuget add source <PACKAGE_SOURCE_PATH> [--name <SOURCE_NAME>] [--username <USER>]
    [--password <PASSWORD>] [--store-password-in-clear-text]
    [--valid-authentication-types <TYPES>] [--configfile <FILE>] [--allow-insecure-connections]

dotnet nuget add source -h|--help

πŸ¦‹ DESCRIPTION πŸ¦‹

the dotnet nuget add source command adds a brand new package source to your NuGet configuration files. that's the whole plot. you point it at a source, it goes in the config, done. iconic behavior honestly.

⚠️ WARNING: when adding multiple package sources, be careful not to introduce a dependency confusion vulnerability. like, fr fr, be careful. this is not a drill. πŸ™ˆ

πŸ“ ARGUMENTS πŸ“

  • PACKAGE_SOURCE_PATH β€” path to the package source. where the goodies live πŸ’–

πŸ’… OPTIONS πŸ’…

  • --configfile <FILE> β€” the NuGet configuration file (nuget.config) to use. if you specify it, only the settings from this file get used, periodt. if you don't specify it, the hierarchy of configuration files from the current directory gets used instead. for more info, see Common NuGet Configurations.
  • --allow-insecure-connections β€” allows HTTP connections for adding or updating packages. bestie. this method is not secure. available since .NET 9 SDK πŸ‘‘
  • -n, --name <SOURCE_NAME> β€” name of the source. give it a cute name, you'll be typing it a lot.
  • -p, --password <PASSWORD> β€” password to be used when connecting to an authenticated source.

heads up: encrypted passwords are only supported on Windows 😭 and even then, they can only be decrypted on the same machine and by the same user who originally encrypted them. so like, it's giving very locked-down. keep that in mind.

  • --store-password-in-clear-text β€” enables storing portable package source credentials by disabling password encryption.
⚠️ WARNING: storing passwords in clear text is strongly discouraged. for more information on managing credentials securely, refer to the security best practices for consuming packages from private feeds. please bestie. don't do it. 🫢
  • -u, --username <USER> β€” username to be used when connecting to an authenticated source.
  • --valid-authentication-types <TYPES> β€” comma-separated list of valid authentication types for this source. set this to basic if the server advertises NTLM or Negotiate and your credentials must be sent using the Basic mechanism β€” for instance, when using a PAT with on-premises Azure DevOps Server. other valid values include negotiate, kerberos, ntlm, and digest, but ngl these values are unlikely to be useful. so. yeah. 🌈

✨ EXAMPLES ✨

here's where it gets fun, watch this πŸ’–

  1. add nuget.org as a source:
dotnet nuget add source https://api.nuget.org/v3/index.json -n nuget.org
  1. add c:\packages as a local source:
dotnet nuget add source c:\packages
  1. add a source that needs authentication:
dotnet nuget add source https://someServer/myTeam -n myTeam -u myUsername -p myPassword
  1. add a source that needs authentication (then go install credential provider):
dotnet nuget add source https://azureartifacts.microsoft.com/myTeam -n myTeam

slay. all four of those are valid and you're valid for reading them. πŸ”₯


πŸ‘‘ SEE ALSO πŸ‘‘

  • Security best practices for managing package source credentials
  • Package source sections in NuGet.config files
  • sources command (nuget.exe)

and that's the whole page bestie, you ate it, no crumbs πŸŽ€ this was dotnet-nuget-add-source(1) from the .NET Documentation, dated 2025-10-30 β€” go add a source, stay safe, trust your feeds, and don't store passwords in clear text. mwah πŸ’–πŸ¦‹βœ¨

πŸ“¦ where this page comes from