TFS Custom Task - Service Actions (for TFS 2015 Update 2.1 or before)
Apparently, boolean values for custom VSTS tasks for versions prior to TFS 2015 Update 3) require some special handling as they don’t pass the checkbox values as actual powershell
$false. Instead the task passes this information along as
false. To properly handle this you’ll need to pass in the value as a
string then convert to
I found a great start on working on this solution in a blog post by Rene which has more detail, so check it out. In addition, some reading on promiscuous types with powershell can be helpful to understand why special handling is needed with conversion. For example, in the task.json file you’ll have:
This boolean value provides a checkbox on the custom task window.
To properly work with the boolean value, you have to bring it in as a script then convert it to a boolean value.
once you have the parameters, use .NET convert functionality to
Below I’ve included a custom TFS Task for basic start/stop/restart/change credentials with a custom tfs task. It’s not super refined, but it’s a good start to get you on your way.