Skip to main content

TaskSetup

This page was generated

Contributions are welcome in Psake-repo.

SYNOPSIS

Adds a scriptblock that will be executed before each task

SYNTAX

__AllParameterSets

TaskSetup [-Setup] <scriptblock> [<CommonParameters>]

DESCRIPTION

This function will accept a scriptblock that will be executed before each task in the build script.

The scriptblock accepts an optional parameter which describes the Task being setup.

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

A scriptblock to execute

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

VERSION

This page was generated using comment-based help in Psake 5.0.3.