I have a TFS build definition.
I wish to run two steps/task that execute two Command Lines, conditionally. Maybe with a variable I could set when I queue the build or something. Mainly I wish to run the build and skip some steps/task if I want to. How can I achieve this? Except making a bat file that executes my app.exe and sending a boolean variable to the bat script that will execute or not my app.exe.
By adding a PowerShell Script task with Write-Host "##vso[task.setvariable variable=ExecuteMyTask]$(ExecuteMyTask)"
before the task that needs to be executed conditionally, a new Process parameter named ExecuteMyTask
is added to the Task Group that can be set to true or false (or left empty, to be set in the Build definition using this Task Group). In the 'conditional' task a Custom Condition and(succeeded(), eq(variables['ExecuteMyTask'], 'true'))
can be added and the task will be executed conditionally.
This works on TFS.2018.2.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With