Error using Parameters in PSake 4.1.0

93 views
Skip to first unread message

Danny Douglass

unread,
Mar 26, 2012, 4:29:12 PM3/26/12
to psake...@googlegroups.com
Hi All,

I'm trying to utilize the parameter feature introduced in the v4 release, but I'm running into an error.  I can only seem to get properties to work...and I have tried passing the parameters using single quotes and double quotes around both.  I used this post as an example:
https://groups.google.com/forum/?fromgroups#!topic/psake-users/UKX3tBzOASE 

Any help here is greatly appreciated - I can also zip up the files if someone wants to try and run them locally.

Executing Call:
 
PowerShell .\_nuget\packages\psake.4.1.0\tools\psake.ps1 sampleScript.ps1 -parameters @{environmentNumber=%TestEnvironmentNumber%}

sampleScript.ps1 contents:

parameters {
    $environmentNumber = $null
}

Task default -depends Print-Properties
Task Print-Properties {
    
    Assert($environmentNumber -ne $null) "environmentNumber should not be null"
     Write-Host "Environment Number: $environmentNumber"}

Execution Output:
c:\dev\HgSilver\_Provision\NebTestEnvironment>PowerShell .\_nuget\packages\psake.4.1.0\tools\psake.ps1 sampleScript.ps1 -parameters @{environmentNumber=0} 
psake version 4.1.0
Copyright (c) 2010 James Kovacs

Warning: Using global variable $framework to set .NET framework version used is deprecated. Ins
tead use Framework function or configuration file psake-config.ps1.
Executing Print-Properties
3/26/2012 4:19:10 PM: An Error Occurred: 
Assert: environmentNumber should not be null
At C:\dev\HgSilver\_Provision\NebTestEnvironment\_nuget\packages\psake.4.1.0\tools\psake.psm1:1
52 char:14
+         throw <<<<  ("Assert: " + $failureMessage) 
    + CategoryInfo          : OperationStopped: (Assert: environ...uld not be null:String) [], 
    RuntimeException
    + FullyQualifiedErrorId : Assert: environmentNumber should not be null
  
Reply all
Reply to author
Forward
0 new messages