Each invocation of NuGet restore will use the provided nuget.config.
Actual, the first time it is executed a file is created at $(Pipeline.Workspace)\Nuget\tempNuGet_$(Build.BuildID).config with the provided config (and then auth keys are added). The second time, the file exists so the nuget.config from nugetConfigPath is ignored (silently).
Task name
DotNetCoreCLI
Task version
2
Environment type (Please select at least one enviroment where you face this issue)
Azure DevOps Server type
dev.azure.com (formerly visualstudio.com)
Azure DevOps Server Version (if applicable)
No response
Operation system
Windows 11
Task log
Relevant log output
Aditional info
Example $(Build.SourcesDirectory)/MyPath2/nuget.config
Expected:
Each invocation of NuGet restore will use the provided nuget.config.
Actual, the first time it is executed a file is created at
$(Pipeline.Workspace)\Nuget\tempNuGet_$(Build.BuildID).config
with the provided config (and then auth keys are added). The second time, the file exists so the nuget.config from nugetConfigPath is ignored (silently).I looked at the source here and it seems to be due to the behavior of
ensureTempConfigCreated()
which uses the existing file even if there is a different config provided https://github.com/microsoft/azure-pipelines-tasks/blob/4db190650be134609d0ea2b8e5294fc80bf0b5b6/Tasks/Common/packaging-common/nuget/NuGetConfigHelper2.ts#L44