Skip to content

Scripts

Luca Sgroi edited this page Dec 4, 2016 · 24 revisions

Scripts are nothing more than plain-text files that have a .PS1 filename extension and they live in the .build\scripts directory. They are meant to define script scope functions. Rather than having script parameters, use properties instead.

Example: Import a custom script .build\scripts\MyScript.ps1

Import-Script MyScript

Scripts are searched and imported sequentially in any Pask.* package installed in the solution, any Pask.* project in the solution and finally the .build\scripts directory. If the same function is defined in different scripts, it would be overridden by the latter imported.

Example: The function Get-Version is defined in a Pask extension and overridden in this script;

Import-Script MyScript

function script:Get-Version {
   ...
}