Task Rebuild -Depends Clean, Build {
"Rebuild"
}
Task Build {
"Build"
}
Task Clean {
"Clean"
}
Task default -Depends Build
# Will display task as:
# -------- Rebuild --------
# -------- Build --------
FormatTaskName "-------- {0} --------"
# will display tasks in yellow colour:
# Running Rebuild
FormatTaskName {
param($taskName)
"Running $taskName" - foregroundcolor yellow
}
Task Rebuild -Depends Clean, Build {
"Rebuild"
}
Task Build {
"Build"
}
Task Clean {
"Clean"
}
Task default -Depends Build
propreties {
$isOk = $false
}
# By default the Build task won't run, unless there is a param $true
Task Build -precondition { return $isOk } {
"Build"
}
Task Clean {
"Clean"
}
Task default -Depends Build
Task Build -depends Clean {
"Build"
}
Task Clean -ContinueOnError {
"Clean"
throw "throw on purpose, but the task will continue to run"
}
Task default -Depends Build