A build automation tool written in PowerShell that leverages your existing command-line knowledge.
psake is a build automation tool written in PowerShell. It avoids the angle-bracket tax associated with executable XML by leveraging the PowerShell syntax in your build scripts. psake has a syntax inspired by rake (aka make in Ruby) and bake (aka make in Boo), but is easier to script because it leverages your existing command-line knowledge.
Note: psake is pronounced "sake" – as in Japanese rice wine. It does NOT rhyme with make, bake, or rake.
psake can be installed in several ways:
Install-Module -Name psake -Scope CurrentUserchoco install psake-
Download and extract the project from the releases page
-
Unblock the zip file before extracting (right-click → Properties → Unblock)
-
Import the module:
Import-Module .\psake.psm1
-
PowerShell 5.1 or later
-
Execution policy set to allow script execution:
Set-ExecutionPolicy RemoteSigned -Scope CurrentUser
We highly recommend reading the psake docs for a more thorough walk through.
-
Create a build script file (e.g.,
psakefile.ps1):Task Default -Depends Test, Package Task Test { Write-Host "Running tests..." } Task Package { Write-Host "Creating package..." }
-
Run the build:
Invoke-psake
Navigate to the examples directory and try out the sample build scripts:
cd .\examples
Invoke-psake # Runs the default task
Invoke-psake .\psakefile.ps1 Clean # Runs the Clean taskGet detailed help and examples:
Get-Help Invoke-psake -FullWhen using PSScriptAnalyzer with psake build scripts, you may encounter warnings like:
PSUseDeclaredVarsMoreThanAssignments: The variable 'build_dir' is assigned but never used.
This is a known limitation - PSScriptAnalyzer's static analysis cannot detect that psake dot-sources Properties blocks into task scope at runtime. The variables ARE actually used, but the analyzer can't see it.
Solution: Use script-scoped variables in your Properties blocks:
Properties {
$script:build_dir = "c:\build"
$script:connection_string = "datasource=localhost;..."
}
Task Compile {
"Building to: $build_dir" # Works identically at runtime
}The $script: prefix has no functional difference at runtime but satisfies PSScriptAnalyzer's static analysis requirements.
For more details, see Get-Help Properties -Full or visit our troubleshooting documentation.
For Visual Studio 2017 and later, psake can automatically locate MSBuild. If you encounter issues, you may need to install the VSSetup PowerShell module:
Install-Module -Name VSSetup -Scope CurrentUserYou can find information about each release of psake in the releases section and the Changelog.
We welcome contributions! Here's how you can get involved:
- GitHub Discussions - Ask questions and share ideas
- PowerShell Discord - Join the #psake channel
- PowerShell Slack - Join the #psake channel
- Fork the main repository and submit pull requests
- Check out the psake docs for documentation
- Browse the issues list for bugs and feature requests
- Explore psake-contrib for additional scripts and modules
psake is released under the MIT license.