Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to pass user variables from TFS 2015 Build definition to power shell script?

I am working on vNext builds TFS 2015. How can we pass a user defined variable from vNext build to power shell script? I am adding powershell script as a step in the build definition.

like image 450
CKS Avatar asked Nov 13 '15 23:11

CKS


2 Answers

You can define build variables, then reference them in the PowerShell task under arguments. For example if my powershell script took a parameter called foo I could do this:

enter image description here enter image description here

like image 155
Dylan Smith Avatar answered Nov 12 '22 02:11

Dylan Smith


You Can access the V next user variables in power shell like below,

Example:

$env:foo

In your case it is,

blah.ps1 -foo $env:foo
like image 25
Thiyagarajan vasu devan Avatar answered Nov 12 '22 02:11

Thiyagarajan vasu devan