We run Pester tests during our tfs release. The output is published as test results and saved to the log files. To save the output.xml to the log file we use task.uploadfile from azure pipeline tasks. This task failed because we had a space between the closing bracket and the file parameter.
##[section]Starting: Add output.xml to log files ============================================================================== Task : PowerShell Description : Run a PowerShell script Version : 1.2.3 Author : Microsoft Corporation Help : [More Information](https://go.microsoft.com/fwlink/?LinkID=613736) ============================================================================== ##[command]. 'C:\Users\service\AppData\Local\Temp\277e9445-a3b5-4910-8cba-5e0aadfedc7e.ps1' ##[error]Unable to process command '##vso[task.uploadfile] D:\Software\TFS\Agents\1\work\r10\a\output.xml' successfully. Please reference documentation (http://go.microsoft.com/fwlink/?LinkId=817296) ##[error]Cannot upload task attachment file, attachment file location is not specified or attachment file not exist on disk ##[section]Finishing: Add output.xml to log files
The solution was to make sure there was nog space between the closing bracket and the file parameter in the powershell task:
Write-Host "##vso[task.uploadfile]$(System.DefaultWorkingDirectory)\output.xml" # there is no space -here---------^