Re: Error using psake.ps1 helper script

16 views
Skip to first unread message

James Kovacs

unread,
Apr 27, 2010, 11:21:18 PM4/27/10
to psake...@googlegroups.com, psak...@googlegroups.com
Thanks for the investigations and reports everyone. I couldn't find a way to support both the splatting operator and named parameters. Seems they don't play well together. The solution that I came up with - if someone has a better solution, I'd love to hear it - is to duplicate the parameters from invoke-psake in psake.ps1 and then call invoke-psake with those parameters. You can find it on master or specifically this commit:

http://github.com/JamesKovacs/psake/commit/64ea235ff890f013427b93551681ad94f3d0c7f1

I'll let people try it out for a bit to ensure that it doesn't introduce other problems. If everyone is happy with the change and no one has a better implementation, I'll release psake 4.01 with the various small fixes so far.

Thanks,
James
--
James Kovacs, B.Sc., M.Sc., MCSD, MCT
Microsoft MVP, ASP/ASP.NET
http://www.jameskovacs.com
jko...@post.harvard.edu | @jameskovacs
403-397-3177 (mobile)


On Mon, Apr 19, 2010 at 7:48 AM, Asger Hallas <asger...@gmail.com> wrote:
Hi

Sorry for my late reply!
Thank you very much for your replies!

Dustin, I actually learned a lot from your posting. I'm new to
PowerShell and I had never heard of Trace-Command. Very valuable.
I guess I will rely on positional parameters then. It's not as
readable, but I need to have a lot of different tasks run on different
environments, so I'd like to have a central runner script (it will
host a more than the original psake.ps1 file).

Thank you again!

// Asger Hallas


On 18 Apr., 18:55, Dustin Venegas <dustin.vene...@gmail.com> wrote:
> It looks like this may be an issue with how you're passing variables and the
> "splat" operator. The short solution to use only positional parameters. For
> example:
> .\psake.ps1 default.ps1 "build-all" 3.5x86
>
> You could also use a hashtable to name every parameter or make another
> script that imports/removes the psake.psm1 and executes invoke-psake for
> your projects. I typically make my own script.
>
> For more information seehttp://jameskovacs.com/2010/03/21/pow-biff-wham-splat/.
>
> *Long Version*
>
> I haven't used the splat (@) operator in powershell before. I executed a
> trace-command on parameter bindings and noticed "-framework" is being bound
> to the framework parameter while "3.5x86" binds to docs.
>
> I'm not even getting clear binding information when I run a trace command on
> .\psake.ps1
> {buildfile="default.ps1";tasklist="build-all";framework="3.5x86"}
>
> PS C:\dev242\foo> trace-command -name parameterbinding {.\psake.ps1
> default.ps1 "build-all" -framework 3.5x86} -PSHost
>
> ( Information truncated for brevity. There is a *lot* of info that
> trace-command outputs).
> DEBUG: ParameterBinding Information: 0 :     BIND arg [-framework] to
> parameter [framework]
> DEBUG: ParameterBinding Information: 0 :     BIND arg [3.5x86] to parameter
> [docs]
>
>
>
>
>
> On Sat, Apr 17, 2010 at 12:19 PM, Jason Jarrett <sta...@gmail.com> wrote:
> > I just repro'd in my open source project - but don't have time to check
> > into it,,,
>
> > If you downloadhttp://github.com/staxmanade/StatLight
>
> > and run the following command
>
> > .\psake.ps1 .\default.ps1 build-all -framework 3.5x86
>
> > I got
>
> > Invoke-psake : Cannot process argument transformation on parameter 'docs'.
> > Cannot convert value "System.String" to type
> >  "System.Management.Automation.SwitchParameter", parameters of this type
> > only accept booleans or numbers, use $true, $f
> > alse, 1 or 0 instead.
> > At C:\Code\StatLight.Git\psake.ps1:4 char:13
> > + invoke-psake <<<<  @args
> >     + CategoryInfo          : InvalidData: (:) [Invoke-psake],
> > ParameterBindin...mationException
> >     + FullyQualifiedErrorId :
> > ParameterArgumentTransformationError,Invoke-psake
>
> > On Sat, Apr 17, 2010 at 9:56 AM, Dustin Venegas <dustin.vene...@gmail.com>wrote:
>
> >> I don't see anything suspicious off the bat. Could you paste your
> >> buildtasks.ps1 into pastebin (http://pastebin.com/) and send us a link?
>
> >> Thanks,
> >> -dv
>
> >> On Fri, Apr 16, 2010 at 9:22 AM, Asger Hallas <asgerhal...@gmail.com>wrote:
>
> >>> Hi again
>
> >>> Another problem for me using psake 4.0 :)
>
> >>> When I write the following:
>
> >>> .\psake.ps1 .\buildtasks.ps1 deploy -framework 3.5x86
>
> >>> I get this error:
>
> >>> Invoke-psake : Cannot process argument transformation on parameter
> >>> 'docs'. Cannot convert value "System.String" to type
> >>>  "System.Management.Automation.SwitchParameter", parameters of this
> >>> type only accept booleans or numbers, use $true, $f
> >>> alse, 1 or 0 instead.
> >>> At C:\workspace\KSLog\master\psake.ps1:4 char:14
> >>> +     invoke-psake <<<<  @args
> >>>    + CategoryInfo          : InvalidData: (:) [Invoke-psake],
> >>> ParentContainsErrorRecordException
> >>>    + FullyQualifiedErrorId :
> >>> ParameterArgumentTransformationError,Invoke-psake
>
> >>> I have tried all possible combinations of argument order. But I can't
> >>> figure out what goes wrong.
> >>> Is this a known issue?
>
> >>> Kind regards
> >>> Asger
>
> >>> --
> >>> You received this message because you are subscribed to the Google Groups
> >>> "psake-users" group.
> >>> To post to this group, send email to psake...@googlegroups.com.
> >>> To unsubscribe from this group, send email to
> >>> psake-users...@googlegroups.com<psake-users%2Bunsubscribe@googlegr oups.com>
> >>> .
> >>> For more options, visit this group at
> >>>http://groups.google.com/group/psake-users?hl=en.
>
> >> --
> >> Dustin Eric Venegas
> >> Dustin.Vene...@gmail.com
>
> >>  --
> >> You received this message because you are subscribed to the Google Groups
> >> "psake-users" group.
> >> To post to this group, send email to psake...@googlegroups.com.
> >> To unsubscribe from this group, send email to
> >> psake-users...@googlegroups.com<psake-users%2Bunsubscribe@googlegr oups.com>
> >> .
> >> For more options, visit this group at
> >>http://groups.google.com/group/psake-users?hl=en.
>
> >  --
> > You received this message because you are subscribed to the Google Groups
> > "psake-users" group.
> > To post to this group, send email to psake...@googlegroups.com.
> > To unsubscribe from this group, send email to
> > psake-users...@googlegroups.com<psake-users%2Bunsubscribe@googlegr oups.com>
> > .
> > For more options, visit this group at
> >http://groups.google.com/group/psake-users?hl=en.
>
> --
> Dustin Eric Venegas
> Dustin.Vene...@gmail.com
>
> --
> You received this message because you are subscribed to the Google Groups "psake-users" group.
> To post to this group, send email to psake...@googlegroups.com.
> To unsubscribe from this group, send email to psake-users...@googlegroups.com.
> For more options, visit this group athttp://groups.google.com/group/psake-users?hl=en.

--
You received this message because you are subscribed to the Google Groups "psake-users" group.
To post to this group, send email to psake...@googlegroups.com.
To unsubscribe from this group, send email to psake-users...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/psake-users?hl=en.


--
You received this message because you are subscribed to the Google Groups "psake-dev" group.
To post to this group, send email to psak...@googlegroups.com.
To unsubscribe from this group, send email to psake-dev+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/psake-dev?hl=en.
Reply all
Reply to author
Forward
0 new messages