If you're using an Azure Pipelines build file and trying to push to a private feed, you can use these snippets, just make sure to update $VARIABLES
and indentation as-needed:
- task: NuGetAuthenticate@0
displayName: "Auth NuGet"
name: Nuget_Authenticate
inputs:
nuGetServiceConnections: '$PROJECT_SETTINGS_SERVICE_CONNECTION_NAME'
forceReinstallCredentialProvider: true
- task: NuGetCommand@2
name: pushNuGetPkg
displayName: "Push NuGet"
inputs:
command: 'push'
packagesToPush: '$(Build.Repository.Localpath)\Packages\*.nupkg'
nuGetFeedType: 'external'
publishFeedCredentials: '$ARTIFACTS_FEED_NAME'
publishVstsFeed: '$AZURE_ORGANIZATION_NAME/$ARTIFACTS_FEED_NAME'
You may also need to set these env-vars up in your ADO Project's Library
-> Defaults
section. Make sure the second one is securely masked with the Lock icon.
NUGET_CREDENTIALPROVIDER_SESSIONTOKENCACHE_ENABLED
: true
VSS_NUGET_EXTERNAL_FEED_ENDPOINTS
: {"endpointCredentials": [{"endpoint":"https://$AZURE_ORG_NAME.pkgs.visualstudio.com/_packaging/$ARTIFACTS_FEED_NAME/nuget/v3/index.json", "username":"$USERNAME", "password":"$PAT"}]}