< Back

Include

Sun Jan 19, 2020 5:58 pm

NAME Include



SYNOPSIS

Include the functions or code of another powershell script file into the current build script's scope





SYNTAX

Include [-fileNamePathToInclude] <String> [<CommonParameters>]





DESCRIPTION

A build script may declare an "includes" function which allows you to define a file containing powershell code to

be included

and added to the scope of the currently running build script. Code from such file will be executed after code from

build script.





PARAMETERS

-fileNamePathToInclude <String>

A string containing the path and name of the powershell file to include



Required? true

Position? 1

Default value

Accept pipeline input? false

Accept wildcard characters? false



<CommonParameters>

This cmdlet supports the common parameters: Verbose, Debug,

ErrorAction, ErrorVariable, WarningAction, WarningVariable,

OutBuffer, PipelineVariable, and OutVariable. For more information, see

about_CommonParameters (https:/go.microsoft.com/fwlink/?LinkID=113216).



INPUTS



OUTPUTS



-------------------------- EXAMPLE 1 --------------------------



PS C:\\>A sample build script is shown below:



Include ".\\build_utils.ps1"



Task default -depends Test



Task Test -depends Compile, Clean {

}



Task Compile -depends Clean {

}



Task Clean {

}



-----------

The script above includes all the functions and variables defined in the ".\\build_utils.ps1" script into the

current build script's scope



Note: You can have more than 1 "Include" function defined in the build script.











RELATED LINKS

Assert

Exec

FormatTaskName

Framework

Get-PSakeScriptTasks

Invoke-psake

Properties

Task

TaskSetup

TaskTearDown