The 4.2.0 version when invoked using the 'invoke-psake' does use the 'default.ps1' build file. Fails with exception. #53

Closed
codemonkeyking opened this Issue Jan 11, 2013 · 5 comments

Comments

Projects
None yet
5 participants

"Test-Path : Cannot bind argument to parameter 'Path' because it is an empty string."

This appears to be a problem with the logic on the line below:

if ($buildFile -and !(test-path $buildFile -pathType Leaf) -and (test-path $psake.config_default.buildFileName -pathType Leaf)) {

This never executes as $buildFile is $null. I've fixed temporarily by assigning a default value of $psake.config_default.buildFileName to the $buildFile.

In psake.psm1 The Invoke-Psake function's buildFile default is $null hence the following if statement on line 285 bombs out.

Fix is Line 269: (add back the default) or similar
[Parameter(Position = 0, Mandatory = 0)][string] $buildFile = $psake.config_default.buildFileName,

I fixed this as follows:

# if no build file is specified, look for the default
if ((!($buildFile)) -and (test-path $psake.config_default.buildFileName -pathType Leaf)) {
    $buildFile = $psake.config_default.buildFileName
}
# If the default.ps1 file exists and the given "buildfile" isn 't found assume that the given 
# $buildFile is actually the target Tasks to execute in the default.ps1 script. 
elseif ($buildFile -and !(test-path $buildFile -pathType Leaf) -and (test-path $psake.config_default.buildFileName -pathType Leaf)) {
    $taskList = $buildFile.Split(', ')
    $buildFile = $psake.config_default.buildFileName
}

slestak commented Nov 19, 2013

It seems that johannesprinz comment #53 (comment) is still desired? This issue still occurs for me without his patch.

Owner

damianh commented Dec 23, 2013

Is this still a problem with v 4.3.1?

Owner

damianh commented Mar 31, 2014

Closing - if verified with 4.3.1, I'll re-open.

damianh closed this Mar 31, 2014

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment