I want to write string message to TFS build summary. I have a Powershell task with variable
$output = $(Build.SourcesDirectory)\scripts\SCRIPT_NAME.ps1
$output
that holds
=====
Numb. of files for patch in:
Win32 = 2
Win64 = 123
---
Numb. of original files:
Win32 = 0
Win64 = 12
=====
that scheme is a whole message, now I just want to display it in a place that picture below points or in any other section as long as it is in "Summary"
I took a look on this Stack question but it answers how to display hyperlink to file. I want to specifically display string not a link to file that holds what I want to print. Additionally I referred to Microsoft docs but I haven't found what I'm looking for
The simple way is just using Logging Commands as your shared link suggested:
##vso[task.uploadsummary]local file path
Upload and attach summary markdown to current timeline record. This summary shall be added to the build/release summary and not available for download with logs.
This will not generate hyperlink in summary, it will directly list the text/content in the shared file on build Summary page. You just need to put the output in a file, then use above command lin.
For example:
Script:
Write-Host "##vso[task.uploadsummary]c:\testsummary.md"
Besides, you could also create your own extension to display graphical content in my Azure DevOps build summary page. (Too complicated, not recommend)
For example add a custom section in build result through your extension, with this way, you can add html test results report in that custom section. There is the sample about build result extension: vsts-extension-samples
More information about how to build extension, you can refer to this article
Create your first extension for Visual Studio Team Services
A extension for your reference Publish HTML Artifact
Update
In md files for Markdown format you could use </br>
to wrap next line. Start a line with a hash character #
to set a heading. For example
=====</br>Processed files statistics </br>Numb. of files for patch in: Win32 = 2 [this is single line]</br> #Win64 = 123 [this is header] </br>[here split to lines rest of report]</br>=====
Then the result format of report you could check right part: