NuGet CLI configuration
When using Artifactory as a NuGet repository you can either work with the NuGet CLI directly or with Visual Studio.To configure the NuGet CLI to work with Artifactory, you need to add this repository to the list of sources.To add this repository, use the following command:
nuget sources Add -Name <REPOSITORY_NAME> -Source https://company.jfrog.io/artifactory/api/nuget/v3/<PACKAGE_NAME>/index.json -username <username> -password <password>Example
nuget sources Add -Name Artifactory -Source https://company.jfrog.io/artifactory/api/nuget/v3/john-nuget-local/index.json -username john -password cmVmdGtuOjAxOjE3OTE4ODI0OTQ6d0lrRU9OUGVqU2dQaFNlNElCNmt4QWo4UDVjThen, to authenticate against Artifactory with the NuGet API key, run the following command:
nuget setapikey <USER-NAME>:<API-KEY> -Source Artifactory
Example
nuget setapikey john:cmVmdGtuOjAxOjE3OTE4ODI0OTQ6d0lrRU9OUGVqU2dQaFNlNElCNmt4QWo4UDVj -Source Artifactory
NuGet CLI Configuration (API v2)
If this repository is configured as a NuGet API v2 repository manually add the following line to the NuGet.config file:The NuGet.config file can be found at %appdata%\NuGet\NuGet.config (Windows) or ~/.config/NuGet/NuGet.config (Mac/Linux)
nuget sources Add -Name ArtifactoryV2 -Source https://company.jfrog.io/artifactory/api/nuget/<REPOSITORY_NAME> -username <username> -password <password>Example
nuget sources Add -Name ArtifactoryV2 -Source https://company.jfrog.io/artifactory/api/nuget/john-nuget-virtual -username john -password cmVmdGtuOjAxOjE3OTE4ODI0OTQ6d0lrRU9OUGVqU2dQaFNlNElCNmt4QWo4UDVjThen, to authenticate against Artifactory with the NuGet API key, run the following command:
nuget setapikey <USER-NAME>:<API-KEY> -Source ArtifactoryV2
Example
nuget setapikey john:cmVmdGtuOjAxOjE3OTE4ODI0OTQ6d0lrRU9OUGVqU2dQaFNlNElCNmt4QWo4UDVj -Source ArtifactoryV2
Visual Studio Configuration
To configure the NuGet Visual Studio Extension to use Artifactory, you need to add this repository as another Package Source under NuGet Package Manager.
Go to the "Package Manager Settings" in your Visual Studio (Tools > NuGet Package Manager > Package Manager Settings > Package Sources) and add another Package Source.
Name: Add a name for the package source (e.g. Artifactory NuGet repository)
Paste the snippet below in the URL field
https://company.jfrog.io/artifactory/api/nuget/v3/<REPOSITORY-NAME>Example
https://company.jfrog.io/artifactory/api/nuget/v3/john-nuget-virtualTo configure the NuGet CLI to work with Artifactory, you need to add this repository to the list of sources. To add this repository, use the following command:
nuget sources Add -Name Artifactory -Source https://company.jfrog.io/artifactory/api/nuget/v3/<REPOSITORY-NAME>/symbols -username <username> -password <password>Example
nuget sources Add -Name Artifactory -Source https://company.jfrog.io/artifactory/api/nuget/v3/john-nuget-local/symbols -username john -password cmVmdGtuOjAxOjE3OTE4ODI0OTQ6d0lrRU9OUGVqU2dQaFNlNElCNmt4QWo4UDVjNuGet CLI Symbol configuration
Add the following line to the NuGet.config file: The NuGet.config file can be found at %appdata%\NuGet\NuGet.config (Windows) or ~/.config/NuGet/NuGet.config (Mac/Linux)
<add key="ArtifactorySymbols" value="https://company.jfrog.io/artifactory/api/nuget/v3/john-nuget-local/symbols" protocolVersion="3" />Then, to authenticate against Artifactory with the NuGet API key, run the following command:
nuget setapikey <USER-NAME>:<API-KEY> -Source ArtifactorySymbols
Example
nuget setapikey john:cmVmdGtuOjAxOjE3OTE4ODI0OTQ6d0lrRU9OUGVqU2dQaFNlNElCNmt4QWo4UDVj -Source ArtifactorySymbols
Visual Studio Configuration (Symbol Server)
To configure the NuGet Visual Studio Extension to use Artifactory as a Symbol Server, you need to change the location of the symbol (.pdb) file. Under Tools | Options | Debugging | Symbols add a new symbol server pointing to the symbols url:
https://company.jfrog.io/artifactory/api/nuget/v3/<REPOSITORY-NAME> Example: https://company.jfrog.io/artifactory/api/nuget/v3/john-nuget-local