7

I'm developing a VSTS extension in Javascript.

In one of my tasks, I need to get a link to my build results. I tried to read from {$Build.BuildUri} but it gives me vstfs:///Build/Build/{buildId} and not a real link.

How can I get a direct link to my build results? I need it both in build and in release pipelines.

yahavi
  • 5,149
  • 4
  • 23
  • 39

1 Answers1

12

The build result page use the URL formatted as below:

https://{vstscollectionuri}/{projectname}/_build/results?buildId={buildid}&_a=summary

And you can get these information via the Predefined Build Variables during the build. In your build task, get the following variables and then combine them to the build result URL.

  • System.TeamFoundationCollectionUri
  • System.TeamProject
  • Build.BuildId
Eddie Chen - MSFT
  • 29,708
  • 2
  • 46
  • 60
  • 1
    Note that System.TeamFoundationCollectionUri will contain the http scheme as well as a trailing slash. The final string using variables is: `$(System.TeamFoundationCollectionUri)$(System.TeamProject)/_build/results?buildId=$(Build.BuildId)&_a=summary` – badsyntax Jun 30 '21 at 07:21