$buildDef = "Service.xxxx"
$buildDefFull="MyProject/$buildDef"
Start-Job -Name 'Service1' -ScriptBlock { tfsbuild start /collection:"http://yyyy:8080/tfs/DefaultCollection" /builddefinition:"$buildDefFull" }
i get this error:
Option builddefinition requires a value.
+ CategoryInfo : NotSpecified: (Option builddefinition requires a value.:String) [], RemoteException
+ FullyQualifiedErrorId : NativeCommandError
+ PSComputerName : localhost
i can't seem to get tfsbuild to accept the parameter in a start job... it actually runs fine if i just do the tfsbuild part with no job.
Any ideas how i'm supposed to pass that value? tx
The $buildDefFull
variable is outside the scope of the scriptblock.
You have 2 options:
Use the Using
scope modifier:
$buildDef = "Service.xxxx"
$buildDefFull="MyProject/$buildDef"
Start-Job -Name 'Service1' -ScriptBlock { tfsbuild start /collection:"http://yyyy:8080/tfs/DefaultCollection" /builddefinition:"$Using:buildDefFull" }
Define and pass parameters to the scriptblock:
$buildDef = "Service.xxxx"
$buildDefFull="MyProject/$buildDef"
Start-Job -Name 'Service1' -ScriptBlock { param($bdf) tfsbuild start /collection:"http://yyyy:8080/tfs/DefaultCollection" /builddefinition:"$bdf" } -ArgumentList $buildDefFull