I want add a message (link) in the build summary (can be a new section also, doesn't really matter):
Based on this: https://blogs.objectsharp.com/post/2017/04/25/Writing-to-the-Build-Report-in-TFS-2015.aspx,
I've added this line in my Powershell script:
Write-Host "##vso[task.addattachment type=Distributedtask.Core.Summary;name=DotCover Results;]"
However I get an error message:
Unable to process command '##vso[task.addattachment type=Distributedtask.Core.Summary;name=DotCover Results;]' successfully. Please reference documentation (http://go.microsoft.com/fwlink/?LinkId=817296) Cannot upload task attachment file, attachment file location is not specified or attachment file not exist on disk
How would one add a text/link/href in the summary of the build? (powershell or other method?)
EDIT: Please see edit below. I run this script from PowerShell during the build step:
$path = $sourcesFolder + "file:///C:/Temp/dotCover-xunit.html"
Write-Host "##vso[task.addattachment type=Distributedtask.Core.Summary;name=DotCover Results;]$path"
EDIT 2: (tried a simple text)
function AddSummaryMessage{
$filePath = "somestring"
Write-Host "##vso[task.uplaodsummary]$filePath"
}
also tried with "hellomessage" as string in there:
Error message:
2019-04-27T01:49:01.1513980Z ##[error]Unable to process command '##vso[task.addattachment type=Distributedtask.Core.Summary;name=DotCover Results;]hellomessage' successfully. Please reference documentation (http://go.microsoft.com/fwlink/?LinkId=817296) 2019-04-27T01:49:01.1516289Z ##[error]Cannot upload task attachment file, attachment file location is not specified or attachment file not exist on disk
EDIT 3:
function AddSummaryMessage{
$file = Get-ChildItem $outputFolder -name "dotcover.html";
if ($file){
LogMessage("Found dotcover report file: " + ($outputFolder + $file))
$path = ($outputFolder + $file)
Write-Host "##vso[task.uplaodsummary]$path"
}
}
OUTPUT:
9:27:01 AM add summary message
9:27:01 AM Found dotcover report file: C:\Builds\tfsbuilddev02\Agent1\110\s\dotCover\dotcover.html
Write-Host "##vso[task.addattachment type=Distributedtask.Core.Summary;name=ObjectSharp;]*$Tempfile*"
– Amit Baranes