From 840dde728adb1a25ca818c4c65f253c16a1a9acd Mon Sep 17 00:00:00 2001 From: wangbill Date: Mon, 3 Aug 2026 11:53:56 -0700 Subject: [PATCH] Restore with command: custom so nuget.config is not rewritten DotNetCoreCLI@2's restore command copies nuget.config into a generated temp config and prefixes every package source key with "feed-". The packageSourceMapping entries the Central Feed Service requires are not rewritten and match on the source key, so after the rewrite the mapping covers no declared source. NuGet excludes the only feed for every package, including the Microsoft.Build.Traversal MSBuild SDK, so evaluating src/dirs.proj fails before any package is fetched: error : Unable to resolve 'Microsoft.Build.Traversal (= 4.1.82)'. PackageSourceMapping is enabled, the following source(s) were not considered: feed-upstream-public. error MSB4236: The SDK 'Microsoft.Build.Traversal' could not be found. Every official build has failed this way since the Central Feed Service change. No nuget.config can work around this. The rewrite prepends "feed-" unconditionally, so a source key never equals its own mapping key under the task, while outside the task they must be equal. Renaming the source, adding the prefixed key to the mapping, or declaring both were each tried and each fails. feedsToUse and nugetConfigPath only apply to the restore and push commands. Using command: custom skips the rewriting entirely and passes nuget.config straight to the CLI, matching how the Pack step already invokes the task. See https://github.com/microsoft/azure-pipelines-tasks/issues/15542 Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 3697a867-8972-4cde-81fd-b3dd94c55066 --- eng/templates/build.yml | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/eng/templates/build.yml b/eng/templates/build.yml index fd163993..bcd404f8 100644 --- a/eng/templates/build.yml +++ b/eng/templates/build.yml @@ -47,14 +47,19 @@ jobs: - task: NuGetAuthenticate@1 displayName: Authenticate NuGet feeds + # Restore uses command: custom rather than command: restore. The restore command's + # feedsToUse/nugetConfigPath inputs make the task copy nuget.config into a generated temp + # config and prefix every package source key with "feed-". Package source mapping matches on + # the source key and those entries are not rewritten, so the mapping the Central Feed Service + # requires stops applying and NuGet excludes the only feed. See + # https://github.com/microsoft/azure-pipelines-tasks/issues/15542. - task: DotNetCoreCLI@2 displayName: Restore inputs: - command: restore - verbosityRestore: Minimal + command: custom + custom: restore projects: $(project) - feedsToUse: config - nugetConfigPath: nuget.config + arguments: --configfile nuget.config --verbosity minimal # Build source directory - task: DotNetCoreCLI@2