New issue checklist
Task name
NuGetCommandv2
Breaking task version
2.270.1
Last working task version
2.267.0
Regression Description
NuGetCommandv2 executes normally, right until the end when it throughs an error trying to remove the temporary nuGet config file:
##[error]Error: Failed rmRF: Command failed: cmd.exe /c del /f /a C:\Users\admings\Downloads\_work\1\Nuget\tempNuGet_187.config
##[error]Packages failed to restore
##[section]Finishing: NuGetCommand
The build pipeline is started from dev.azure.com and uses a self hosted agent server, no changes have been made to the agent server since the last successful run.
After the task ends the temporary .config file reference has gone.
I can't be certain, but watching the folder it seems as if the file vanishes before the task ends, so possibly the command is trying to delete a file that has already been deleted?
The logs with system.debug on seem to show that it does a
rm -rf D:\agent\_work\1\Nuget\tempNuGet_200.config
and then tries to do a
cmd.exe /c del /f /a D:\agent\_work\1\Nuget\tempNuGet_200.config
immediately after
v2.267.0 which I last used on 10th March executed with no problem. The error is occurring with v2.270.0
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 Server 2019
Relevant log output
2026-04-07T13:27:35.7302657Z ##[section]Starting: NuGetCommand
2026-04-07T13:27:35.7328977Z ==============================================================================
2026-04-07T13:27:35.7329545Z Task : NuGet
2026-04-07T13:27:35.7329872Z Description : Restore, pack, or push NuGet packages, or run a NuGet command. Supports NuGet.org and authenticated feeds like Azure Artifacts and MyGet. Uses NuGet.exe and works with .NET Framework apps. For .NET Core and .NET Standard apps, use the .NET Core task.
2026-04-07T13:27:35.7330876Z Version : 2.270.1
2026-04-07T13:27:35.7331450Z Author : Microsoft Corporation
2026-04-07T13:27:35.7331826Z Help : https://docs.microsoft.com/azure/devops/pipelines/tasks/package/nuget
2026-04-07T13:27:35.7332324Z ==============================================================================
2026-04-07T13:27:42.2675351Z [command]C:\Windows\system32\chcp.com 65001
2026-04-07T13:27:42.2860259Z Active code page: 65001
2026-04-07T13:27:42.4998192Z Detected NuGet version 7.3.0.70 / 7.3.0+d180641dd6fb931f78efda35b1b3149358f7b75d.d180641dd6fb931f78efda35b1b3149358f7b75d
2026-04-07T13:27:42.5145569Z [command]C:\Users\User0002\Downloads\_work\_tool\NuGet\7.3.0\x64\nuget.exe sources Add -
.
.
.
.
2026-04-07T13:27:51.8447160Z Feeds used:
2026-04-07T13:27:51.8447749Z C:\Users\User0001\.nuget\packages\
2026-04-07T13:27:51.8448358Z https://api.nuget.org/v3/index.json
2026-04-07T13:27:51.8455888Z
2026-04-07T13:27:51.8457281Z Installed:
2026-04-07T13:27:51.8467461Z 78 package(s) to packages.config projects
2026-04-07T13:27:51.8591801Z
2026-04-07T13:27:51.9159973Z ##[error]Error: Failed rmRF: Command failed: cmd.exe /c del /f /a C:\Users\User0002\Downloads\_work\1\Nuget\tempNuGet_187.config
2026-04-07T13:27:51.9169474Z ##[error]Packages failed to restore
2026-04-07T13:27:51.9276197Z ##[section]Finishing: NuGetCommand
Full task logs with system.debug enabled
UNSUCCESSFUL RUN
2026-04-08T10:14:59.6369545Z ##[debug]Evaluating condition for step: 'NuGetCommand'
2026-04-08T10:14:59.6371737Z ##[debug]Evaluating: SucceededNode()
2026-04-08T10:14:59.6372516Z ##[debug]Evaluating SucceededNode:
2026-04-08T10:14:59.6373781Z ##[debug]Result: True
2026-04-08T10:14:59.6376537Z ##[section]Starting: NuGetCommand
2026-04-08T10:14:59.6396397Z ==============================================================================
2026-04-08T10:14:59.6396813Z Task : NuGet
2026-04-08T10:14:59.6397044Z Description : Restore, pack, or push NuGet packages, or run a NuGet command. Supports NuGet.org and authenticated feeds like Azure Artifacts and MyGet. Uses NuGet.exe and works with .NET Framework apps. For .NET Core and .NET Standard apps, use the .NET Core task.
2026-04-08T10:14:59.6397833Z Version : 2.270.1
2026-04-08T10:14:59.6398066Z Author : Microsoft Corporation
2026-04-08T10:14:59.6398332Z Help : https://docs.microsoft.com/azure/devops/pipelines/tasks/package/nuget
2026-04-08T10:14:59.6398701Z ==============================================================================
2026-04-08T10:15:00.9022289Z ##[debug]Using node path: D:\agent\externals\node24\bin\node.exe
2026-04-08T10:15:02.4406658Z ##[debug]system.debug=true
2026-04-08T10:15:02.4408301Z ##[debug]DistributedTask.Tasks.Node.SkipDebugLogsWhenDebugModeOff=True
2026-04-08T10:15:02.5501488Z ##[debug]agent.TempDirectory=D:\agent\_work\_temp
2026-04-08T10:15:02.5509187Z ##[debug]loading inputs and endpoints
2026-04-08T10:15:02.5545741Z ##[debug]loading ENDPOINT_AUTH_PARAMETER_SYSTEMVSSCONNECTION_ACCESSTOKEN
2026-04-08T10:15:02.5669676Z ##[debug]loading ENDPOINT_AUTH_SCHEME_SYSTEMVSSCONNECTION
2026-04-08T10:15:02.5673496Z ##[debug]loading ENDPOINT_AUTH_SYSTEMVSSCONNECTION
2026-04-08T10:15:02.5677815Z ##[debug]loading INPUT_ALLOWPACKAGECONFLICTS
2026-04-08T10:15:02.5681562Z ##[debug]loading INPUT_COMMAND
2026-04-08T10:15:02.5685422Z ##[debug]loading INPUT_CONFIGURATIONTOPACK
.
.
.
.
.
2026-04-08T10:15:16.6761138Z Installed:
2026-04-08T10:15:16.6771883Z 78 package(s) to packages.config projects
2026-04-08T10:15:16.6908846Z
2026-04-08T10:15:16.7048104Z ##[debug]Process exited with code 0 and signal null for tool 'D:\agent\_work\_tool\NuGet\7.3.0\x64\nuget.exe'
2026-04-08T10:15:16.7049825Z ##[debug]STDIO streams have closed and received exit code 0 and signal null for tool 'D:\agent\_work\_tool\NuGet\7.3.0\x64\nuget.exe'
2026-04-08T10:15:16.7052599Z ##[debug]rm -rf D:\agent\_work\1\Nuget\tempNuGet_200.config
2026-04-08T10:15:16.7054777Z ##[debug]removing file D:\agent\_work\1\Nuget\tempNuGet_200.config
2026-04-08T10:15:16.7392208Z ##[debug]Error: Command failed: cmd.exe /c del /f /a D:\agent\_work\1\Nuget\tempNuGet_200.config
2026-04-08T10:15:16.7417392Z ##[error]Error: Failed rmRF: Command failed: cmd.exe /c del /f /a D:\agent\_work\1\Nuget\tempNuGet_200.config
2026-04-08T10:15:16.7425849Z ##[debug]Processed: ##vso[task.issue type=error;source=TaskInternal;correlationId=98c42e29-0f2e-47ac-80f4-f4ea563aca89;]Error: Failed rmRF: Command failed: cmd.exe /c del /f /a D:\agent\_work\1\Nuget\tempNuGet_200.config
2026-04-08T10:15:16.7427737Z ##[debug]task result: Failed
2026-04-08T10:15:16.7430054Z ##[error]Packages failed to restore
2026-04-08T10:15:16.7432115Z ##[debug]Processed: ##vso[task.issue type=error;source=TaskInternal;correlationId=98c42e29-0f2e-47ac-80f4-f4ea563aca89;]Packages failed to restore
2026-04-08T10:15:16.7440158Z ##[debug]Processed: ##vso[task.complete result=Failed;]Packages failed to restore
2026-04-08T10:15:16.7551272Z ##[section]Finishing: NuGetCommand
SUCCESSFUL RUN
[No longer able to get successful run]
Repro steps
trigger:
batch: true
branches:
include:
- /*
pool:
name: 'My Agent Pool'
variables:
- group: EDI-Tools
- name: Patch
${{ if endsWith(variables['Build.SourceBranchName'], 'origin') }}:
value: 10
${{ elseif endsWith(variables['Build.SourceBranchName'], 'hotfix') }}:
value: 2
${{ elseif endsWith(variables['Build.SourceBranchName'], 'develop') }}:
value: 1
${{ else }}:
value: 0
- name: solution
value: '**/*.sln'
- name: buildPlatform
value: 'Any CPU'
- name: buildConfiguration
value: 'Prod'
- name: version
value: '$(grpMajorVersion).$(grpMinorVersion).$(Patch)$(Rev:.r)' # save the version number to pass into build arguments
- name: system.debug
value: 'true'
name: $(grpMajorVersion).$(grpMinorVersion).$(Patch)$(Rev:.r)
stages:
- stage: Build
jobs:
- job: Build
displayName: Build, test & publish for ${{ variables['Build.SourceBranchName'] }}
steps:
- task: NuGetToolInstaller@1
- task: NuGetCommand@2
inputs:
restoreSolution: '$(solution)'
continueOnError: true # attempt to get round mysterious NuGetCommand@2 error when deleting temp config file
New issue checklist
Task name
NuGetCommandv2
Breaking task version
2.270.1
Last working task version
2.267.0
Regression Description
NuGetCommandv2 executes normally, right until the end when it throughs an error trying to remove the temporary nuGet config file:
The build pipeline is started from dev.azure.com and uses a self hosted agent server, no changes have been made to the agent server since the last successful run.
After the task ends the temporary .config file reference has gone.
I can't be certain, but watching the folder it seems as if the file vanishes before the task ends, so possibly the command is trying to delete a file that has already been deleted?
The logs with system.debug on seem to show that it does a
rm -rf D:\agent\_work\1\Nuget\tempNuGet_200.configand then tries to do a
cmd.exe /c del /f /a D:\agent\_work\1\Nuget\tempNuGet_200.configimmediately after
v2.267.0 which I last used on 10th March executed with no problem. The error is occurring with v2.270.0
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 Server 2019
Relevant log output
Full task logs with system.debug enabled
UNSUCCESSFUL RUN
SUCCESSFUL RUN
Repro steps