1

I'm using TFS2015 update 1. I want to pass information from one build step to the next, how is this possible?

That seems like a very simple task, but I can't figure out how that's suppose to work. Passing a variable to a build step is easy, but passing information from one step to the next seems to be impossible. I hope I'm wrong.

Tom Kuijsten
  • 337
  • 4
  • 16
  • Via Powershell - http://stackoverflow.com/questions/33358708/tfs-build-vnext-how-to-write-to-a-custom-build-variable-from-powershell – chief7 Jan 26 '16 at 20:46

1 Answers1

3

You can call the task.setvariable Logging Command, which sets a variable in the variable service of taskcontext. The first task can set a variable, and following tasks are able to use the variable. The variable is exposed to the following tasks as an environment variable. Example:

##vso[task.setvariable variable=testvar;]testvalue
0xced
  • 25,219
  • 10
  • 103
  • 255
Cece Dong - MSFT
  • 29,631
  • 1
  • 24
  • 39
  • 1
    I know this was answered (and accepted) MONTHS ago. But it's worth pointing out some emphasis on this needing to be the FIRST task in a build... i had a powershell task as the 3rd step and this setvariable did not work... the documentation glosses over the importance of it needing to be first (i was thinking i could modify the variable mid-tasks and use the updated value in subsequent tasks)... in case anyone else needs this. – Robin Aug 26 '16 at 17:40