powershellbuildcustom-build-stepcustom-build

Custom Build variables


My Company works with custom buildsteps based on Powershell scripts.

My task now is to verify whether it is possible to 'export' Variables form these scripts to the global build variables available in tfs itself? Somewhat like $env:build_Myvairable (in script) / $(build.myvariable) (on Tfs).


Solution

  • You can set variables that can be used in subsequent build tasks in TFS/VSTS by writing:

    "##vso[task.setvariable variable=testvar;]testvalue"

    Out to the log... This will create or update a build variable.