Cannot upload task attachment file

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---------^

About erictummers

Working in a DevOps team is the best thing that happened to me. I like challenges and sharing the solutions with others. On my blog I’ll mostly post about my work, but expect an occasional home project, productivity tip and tooling review.
This entry was posted in Development and tagged , , , , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.