Skip to content

LoadTask Task

Aaron Jensen edited this page Sep 27, 2019 · 1 revision

Overview

The LoadTask task loads custom tasks into your build. Set the Path parameter to a list of paths to PowerShell script files that contain tasks. Wildcards are allowed.

If any file contains no tasks, the build build will fail. If Whiskey has already loaded tasks from a file during the current build, it is skipped.

In order for Whiskey to find and run your tasks, they must be scoped at the script level, i.e. prefix all your task functions with the script: scope, e.g.

function script:MyTask
{
    [Whiskey.Task('MyTask')]
    param(
        [Parameter(Mandatory=$true)]
        [Whiskey.Context]
        $TaskContext,

        [Parameter(Mandatory=$true)]
        [hashtable]
        $TaskParameter        
    )
}

See Writing Tasks for documentation on how to write your own tasks.

Properties

  • Path (mandatory): a list of paths to PowerShell script files, each containing task functions.

Examples

Example 1

Build:
- LoadTask:
    Path: Build\Whiskey\*.ps1

Demonstrates how to load tasks. In this example, all the tasks in all the *.ps1 files the Build\Whiskey directory are loaded.

Clone this wiki locally