A build automation tool written in PowerShell that leverages your existing command-line knowledge.
What is psake?
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.
Installation
psake can be installed in several ways:
Option 1: PowerShell Gallery (Recommended)
Install-Module -Name psake -Scope CurrentUser
Option 2: Chocolatey
Option 3: Manual Installation
-
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
Quick Start
Prerequisites
-
PowerShell 5.1 or later
-
Execution policy set to allow script execution:
Set-ExecutionPolicy RemoteSigned -Scope CurrentUser
Your First Build Script
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:
Running Examples
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 task
Getting Help
Get detailed help and examples:
Get-Help Invoke-psake -Full
Troubleshooting
PSScriptAnalyzer Warnings in Properties Blocks
When 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.
Visual Studio Integration
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 CurrentUser
Release Notes
You can find information about each release of psake in the releases section and the Changelog.
Contributing
We welcome contributions! Here's how you can get involved:
Community
- GitHub Discussions - Ask questions and share ideas
- PowerShell Discord - Join the #psake channel
- PowerShell Slack - Join the #psake channel
Development
- 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
License
psake is released under the MIT license.