Nuget restore using Artifactory:

ARTIFACTORY: How to perform Nuget restore using Artifactory

AuthorFullName__c
Tatarao Vana
articleNumber
000005270
ft:sourceType
Salesforce
FirstPublishedDate
2022-05-17T10:39:52Z
lastModifiedDate
2022-05-17
VersionNumber
3
If a package isn't already installed, NuGet first attempts to retrieve it from the cache. If the package is not available in the cache, NuGet tries to download the package from all enabled sources in the list and we have to configure Artifactory here to resolve the packages based on the Nuget client requirement. Here is the sample client configuration.

Configure the Nuget client to resolve package from Artifactory
$ cat ~/.config/NuGet/NuGet.Config 
<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <packageSources>
    <add key="Artifactory" value="http://art.local/artifactory/api/nuget/v3/test-nuget" />
    <add key="ArtifactoryV2" value="http://art.local/artifactory/api/nuget/test-nuget" />
  </packageSources>
  <packageSourceCredentials>
    <Artifactory>
        <add key="Username" value="testadmin" />
        <add key="Password" value="XXXXX" />
      </Artifactory>
    <ArtifactoryV2>
      <add key="Username" value="testadmin" />
      <add key="Password" value="XXXXX" />
    </ArtifactoryV2>
  </packageSourceCredentials>
  <apikeys>
    <add key="http://art.local/artifactory/api/nuget/test-nuget" value="XXXX" />
    <add key="http://art.local/artifactory/api/nuget/v3/test-nuget" value="XXXX" />
  </apikeys>
  </apikeys>
</configuration>