Listing all build variables and their current values in Team Build 2015

When Microsoft first released the new Build system in TFS 2015, I used a Command Line build step to list all variables in the log file to help me troubleshoot paths. As you can see in the screenshot below, it was very easy and only required two items to be specified in the build step.

[UPDATE] Thanks to Graham who reminded me in the comments that this also allows you to list all variables as part of a release, not just a build workflow.

Command Line Build Step Settings (Old version)

  1. Tool was set to cmd
  2. Arguments was set to /k set

 

ListVariablesOld

Unfortunately when they updated the Command Line build step, the values I had been using no longer worked.  Here’s the error message I received in the log files.

“Warning message highlight pattern:  ‘set”‘ is not recognized as an internal or external command, operable program or batch file.”

With the updated Command Line build step, you need to add the “.exe” to output the build variables and their values in your log file.

Command Line Build Step Settings (Current version – Apr 2016)

  • Tool was set to cmd.exe
  • Arguments was set to /k set

 

These values will still give a single line error in your log files claiming “File name doesn’t indicate a full path to a executable file” but the command and arguments still do the job.

As you can see from the screenshot below, once the build has run you can select the Run cmd.exe item in the log and you’ll see all of the variables available for you to use in other build steps and their current values. This is super helpful in troubleshooting.

ListVariablesNew