PowerShell Batchfile
Failed to load latest commit information.
InvokeBuild Deprecate `use VisualStudio`. Nov 21, 2017
Tasks Add Set-BuildFooter, close #125 Apr 1, 2018
Tests Fix Tests/ArgumentCompleters Jul 20, 2018
.build.ps1 Add the robust helper `remove`, close #123 Mar 23, 2018
.gitignore New-VSCodeTask.ps1 resolve #24, output encoding, console host Jun 1, 2016
Build-Checkpoint.ps1 v5.0.0 Jan 1, 2018
Build-Parallel.ps1 Rename some internal commands. Jan 9, 2018
Convert-psake.ps1 Improve some errors and convert-psake. Jan 8, 2018
Invoke-Build.ArgumentCompleters.ps1 Tweak Invoke-Build.ArgumentCompleters.ps1 Aug 31, 2016
Invoke-Build.ps1 Add help for `Set-BuildHeader`, `Set-BuildFooter`. Apr 7, 2018
Invoke-TaskFromISE.ps1 v5.0.0 Jan 1, 2018
Invoke-TaskFromVSCode.ps1 Resolve #118 (save file on invoking from VSCode). Improve errors in … Feb 22, 2018
InvokeBuild-Help.ps1 Add help for `Set-BuildHeader`, `Set-BuildFooter`. Apr 7, 2018
LICENSE.txt v5.0.0 Jan 1, 2018
New-VSCodeTask.ps1 Fix updating existing generated tasks, #130 May 13, 2018
README.md README Mar 5, 2018
Register-VSCodeTask.ps1 v5.0.0 Jan 1, 2018
Release-Notes.md Add help for `Set-BuildHeader`, `Set-BuildFooter`. Apr 7, 2018
Resolve-MSBuild.ps1 Add Latest to Resolve-MSBuild, close #122. Mar 17, 2018
Show-BuildDgml.ps1 Include task synopses in Show-BuildDgml.ps1, #116 Jan 24, 2018
Show-BuildGraph.ps1 Support viz.js in Show-BuildGraph Feb 22, 2018
Show-BuildTree.ps1 v5.0.0 Jan 1, 2018
Show-TaskHelp.ps1 Sort parameters in Show-TaskHelp - switches after others Feb 14, 2018
ib.cmd Fix #81, New-VSCodeTask and VSCode 1.14. Fix potential PS v6-beta.3 i… Jul 12, 2017
ib.png v2.9.9 May 31, 2014


NuGet PSGallery

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

  • Incremental tasks with effectively processed inputs and outputs.
  • Persistent builds which can be resumed after interruptions.
  • Parallel builds in separate workspaces with common stats.
  • Batch invocation of tests composed as tasks.
  • Ability to define new classes of tasks.

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

Invoke-Build can be effectively used in VSCode and ISE.

Several PowerShell Team projects use Invoke-Build.

The package

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

  • Invoke-Build.ps1 - invokes build scripts, this is the build engine
  • Build-Checkpoint.ps1 - invokes persistent builds using the engine
  • Build-Parallel.ps1 - invokes parallel builds using the engine
  • Resolve-MSBuild.ps1 - finds the specified or latest MSBuild
  • Show-TaskHelp.ps1 - shows task help, used on WhatIf calls
  • InvokeBuild-Help.xml - external content for Get-Help
  • ib.cmd - Invoke-Build helper for cmd.exe

Extra tools, see PSGallery and the repository:

  • Invoke-Build.ArgumentCompleters.ps1 - completers for v5 native, TabExpansionPlusPlus, TabExpansion2.ps1
  • Invoke-TaskFromVSCode.ps1 - invokes a task from a build script opened in VSCode
  • New-VSCodeTask.ps1 - generates VSCode tasks bound to build script tasks
  • Invoke-TaskFromISE.ps1 - invokes a task from a script opened in ISE

And some more tools, see the repository:

  • Convert-psake.ps1 - converts psake build scripts
  • Show-BuildTree.ps1 - shows task trees as text
  • Show-BuildDgml.ps1 - shows task trees as DGML
  • Show-BuildGraph.ps1 - shows task trees by Graphviz

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. NOTE: This package is maintained by its owner, see package info.

choco install invoke-build

Module commands: Invoke-Build, Build-Checkpoint, Build-Parallel. 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. This package includes the module files, so it can be used as the module, too, either copy it to the standard module folder or import its InvokeBuild.psd1.

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 package manually, rename it to zip, extract its tools and rename to InvokeBuild. Consider to include this directory to the path so that script paths may be omitted in commands. Or copy to the PowerShell module directory in order to use as the module.

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, see (Get-Alias Invoke-Build).Definition

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

  • Basic Concepts : Why build scripts may have advantages over normal scripts.
  • Script Tutorial : Take a look in order to get familiar with build scripts.
  • Project Wiki : Detailed tutorials, helpers, notes, and etc.
  • Examples : Build scripts used in various projects.
  • Tasks : Samples, patterns, and various techniques.
  • Design Notes : Technical details for contributors.

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