NuGet

Build Automation in PowerShell

Invoke-Build is a build and test automation tool which invokes tasks defined in PowerShell v2.0+ scripts. It is similar to psake but arguably easier to use and more powerful. It is complete, bug free, well covered by tests.

In addition to basic task processing the engine supports

Invoke-Build can invoke the current task from a build script being composed in ISE and VSCode, see Invoke-TaskFromISE.ps1 and Invoke-TaskFromVSCode.ps1.

Invoke-Build can be used as the task runner in VSCode with tasks maintained in a PowerShell build script instead of tasks.json, see New-VSCodeTask.ps1.

Invoke-Build v3.0.1 is cross-platform with PowerShell v6.0.0-alpha.

The package

The package includes the engine, helpers, and the generated help:

Extra tools, see PSGallery and the repository:

And some more tools, see the repository:

Install as module

Invoke-Build is distributed as the module InvokeBuild. In PowerShell 5.0 or with PowerShellGet you can install it by this command

Install-Module InvokeBuild

To install the module with Chocolatey, run the following command

choco install invoke-build

The module provides commands Invoke-Build and Invoke-Builds. Import the module in order to make them available:

Import-Module InvokeBuild

You can also call the module scripts directly. Consider to include the module directory to the path. In this scenario you do not have to import the module.

Install as scripts

Invoke-Build is also distributed as the NuGet package Invoke-Build.

If you use scoop then invoke

scoop install invoke-build

and you are done, scripts are downloaded and their directory is added to the path. You may need to start a new PowerShell session with the updated path.

Otherwise download the directory "Invoke-Build" to the current location by this PowerShell command:

Invoke-Expression "& {$((New-Object Net.WebClient).DownloadString('https://github.com/nightroman/PowerShelf/raw/master/Save-NuGetTool.ps1'))} Invoke-Build"

Consider to include the directory with scripts to the path so that script paths may be omitted in commands.

With cmd.exe use the helper ib.cmd. For similar experience in interactive PowerShell use an alias ib defined in a PowerShell profile

Set-Alias ib <path>\Invoke-Build.ps1

<path>\ may be omitted if the script is in the path.

Getting help

If you are using the module (see #2899) or the script is not in the path then use the full path to Invoke-Build.ps1 instead of Invoke-Build in the below commands.

In order to get help for the engine, invoke:

help Invoke-Build -full

In order to get help for internal commands:

. Invoke-Build
help task -full
help exec -full
...

Online resources

Questions, suggestions, and reports are welcome as project issues. Or just hit me up on Twitter @romkuzmin

Credits