TaskSetup
Contributions are welcome in Psake-repo.
SYNOPSIS
Adds a scriptblock that will be executed before each task
SYNTAX
__AllParameterSets
TaskSetup [-Setup] <scriptblock> [<CommonParameters>]
DESCRIPTION
Use this for per-task setup that applies across all tasks, such as logging, timing, or environment checks. The scriptblock receives the current [PsakeTask] as an optional argument.
EXAMPLES
EXAMPLE 1
Task default -Depends Test
Task Test -Depends Compile, Clean {
}
Task Compile -Depends Clean {
}
Task Clean {
}
TaskSetup {
"Running 'TaskSetup' for task $context.Peek().currentTaskName"
}
The script above produces the following output:
Running 'TaskSetup' for task Clean
Executing task, Clean...
Running 'TaskSetup' for task Compile
Executing task, Compile...
Running 'TaskSetup' for task Test
Executing task, Test...
Build Succeeded
EXAMPLE 2
Task default -Depends Test
Task Test -Depends Compile, Clean {}
Task Compile -Depends Clean {}
Task Clean {}
TaskSetup {
param($task)
"Running 'TaskSetup' for task $($task.Name)"
}
The script above produces the following output:
Running 'TaskSetup' for task Clean
Executing task, Clean...
Running 'TaskSetup' for task Compile
Executing task, Compile...
Running 'TaskSetup' for task Test
Executing task, Test...
Build Succeeded
PARAMETERS
-Setup
Receives the current task as an optional [PsakeTask] argument.
Type: System.Management.Automation.ScriptBlock
DefaultValue: ''
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
Position: 0
IsRequired: true
ValueFromPipeline: false
ValueFromPipelineByPropertyName: false
ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''
CommonParameters
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutBuffer, -OutVariable, -PipelineVariable, -ProgressAction, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.
INPUTS
OUTPUTS
NOTES
RELATED LINKS
VERSION
This page was generated using comment-based help in Psake 5.0.4.