1dotnet-nuget-add-source(1) .NET Documentation dotnet-nuget-add-source(1)
2
3
4
6 This article applies to: ✔️ .NET Core 3.1.200 SDK and later versions
7
9 dotnet-nuget-add-source - Add a NuGet source.
10
12 dotnet nuget add source <PACKAGE_SOURCE_PATH> [--name <SOURCE_NAME>] [--username <USER>]
13 [--password <PASSWORD>] [--store-password-in-clear-text]
14 [--valid-authentication-types <TYPES>] [--configfile <FILE>]
15
16 dotnet nuget add source -h|--help
17
19 The dotnet nuget add source command adds a new package source to your
20 NuGet configuration files.
21
22 [!WARNING] When adding multiple package sources, be careful not
23 to introduce a dependency confusion vulnerability
24 (https://aka.ms/pkg-sec-wp).
25
27 • PACKAGE_SOURCE_PATH
28
29 Path to the package source.
30
32 • --configfile <FILE>
33
34 The NuGet configuration file (nuget.config) to use. If specified,
35 only the settings from this file will be used. If not specified, the
36 hierarchy of configuration files from the current directory will be
37 used. For more information, see Common NuGet Configurations.
38
39 • -n|--name <SOURCE_NAME>
40
41 Name of the source.
42
43 • -p|--password <PASSWORD>
44
45 Password to be used when connecting to an authenticated source.
46
47 • --store-password-in-clear-text
48
49 Enables storing portable package source credentials by disabling
50 password encryption.
51
52 • -u|--username <USER>
53
54 Username to be used when connecting to an authenticated source.
55
56 • --valid-authentication-types <TYPES>
57
58 Comma-separated list of valid authentication types for this source.
59 Set this to basic if the server advertises NTLM or Negotiate and your
60 credentials must be sent using the Basic mechanism, for instance when
61 using a PAT with on-premises Azure DevOps Server. Other valid values
62 include negotiate, kerberos, ntlm, and digest, but these values are
63 unlikely to be useful.
64
66 • Add nuget.org as a source:
67
68 dotnet nuget add source https://api.nuget.org/v3/index.json -n nuget.org
69
70 • Add c:\packages as a local source:
71
72 dotnet nuget add source c:\packages
73
74 • Add a source that needs authentication:
75
76 dotnet nuget add source https://someServer/myTeam -n myTeam -u myUsername -p myPassword --store-password-in-clear-text
77
78 • Add a source that needs authentication (then go install credential
79 provider):
80
81 dotnet nuget add source https://azureartifacts.microsoft.com/myTeam -n myTeam
82
84 • Package source sections in NuGet.config files
85
86 • sources command (nuget.exe)
87
88
89
90 2022-10-10 dotnet-nuget-add-source(1)