Build file required when running psake

Skip to first unread message

Joe Young

Aug 12, 2013, 2:00:04 PM8/12/13
I'm new to psake and trying to get my head wrapped around it.

When executing psake from the command line (powershell) do you always have to specify the build file as in

.\psake default.ps1 Build

I have noticed that if I do not specify the file I get an error but psake keeps on running.

If I don't specify a build file and task it works with no error: .\psake  
If I specify a task an no build file I get the below error: .\psake Build
If I specific a task and build file then it works with no error: .\psake default.ps1 Build

Test-Path : The given path's format is not supported.
At C:\users\jyoung\projects\MyProject-Specifications\psake.ps1:40 char:18
+     if (test-path <<<<  $absoluteBuildFile)    {
    + CategoryInfo          : InvalidOperation: (C:\users\jyoung...ons\Build:String) [Test-Path], NotSupportedException
    + FullyQualifiedErrorId : ItemExistsNotSupportedError,Microsoft.PowerShell.Commands.TestPathCommand

So if you want to run a specific task, you need to specify the build file.

It looks like in psake.ps1 if I don't specify the build file then it thinks the build file is the task.

Is this intended? Looking through psake.ps1 and psake.config, they both indicate or default the build file to "default.ps1" but I still have to put it on the command line?


Jonathan Matheus

Aug 12, 2013, 7:29:02 PM8/12/13
Hey Joe,
This is a powershell thing. If you look in psake.ps1, you should see something along the lines of:

    [string]$buildFile = 'default.ps1',
    [string[]]$taskList = @(),
    [switch]$docs = $false,
    [System.Collections.Hashtable]$parameters = @{},
    [Parameter(Position=5, Mandatory=0)]
    [System.Collections.Hashtable]$properties = @{},
    [Parameter(Position=6, Mandatory=0)]
    [scriptblock]$initialization = {},
    [Parameter(Position=7, Mandatory=0)]
    [switch]$nologo = $false,
    [Parameter(Position=8, Mandatory=0)]
    [switch]$help = $false,
    [Parameter(Position=9, Mandatory=0)]
    [string]$scriptPath = $(Split-Path -parent $MyInvocation.MyCommand.path)

this is how powershell defines function parameters. If you want to specify a parameter, just specify it by name:

.\psake.ps1 -taskList Build

Good luck!

You received this message because you are subscribed to the Google Groups "psake-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
To post to this group, send email to
Visit this group at
For more options, visit

Reply all
Reply to author
0 new messages