Hi again,
I finally found what was causing the error!
Since Powershell 2.0 came out I usually always start my scripts with:
Set-StrictMode -Version 2
This catches any unset variables, non-existent properties....
It seems that it does not play well with pSake.
Why it took me so long to realize, is that I just found out there is a
difference between
powershell.exe .\build.ps1 > ignores the strict mode cmdlet
and runs fine
powershell.exex -File build.ps1 > applies the strict mode cmdlet
and fails to load pSake
For the moment I will simply remove strict mode from my scripts.
Is this something that pSake might handle in the future?
Thanks,
Romain
On May 24, 3:03 pm, Romain <choicesm...@gmail.com> wrote:
> Hi everyone,
> I've been using pSake for a few weeks now and everything was working
> great!
> We currently call the builds sucessfully on both desktops and the CI
> server like this:
> > powershell.exe .\build.ps1 (this script imports the module and invokes pSake on the tasks file)
> However, for various reasons (I can elaborate if needed), I realised I
> needed to invoke pSake like this:
> > powershell.exe -File build.ps1
> However this approach failed, giving the following error message:
> The variable '$script:context' cannot be retrieved because it has not
> been set.
> At C:\Documents and Settings\Administrator\Desktop\Powershell\pSake
> \pSake.psm1:24 char:42
> + [system.collections.stack]$script:context <<<<
> + CategoryInfo : InvalidOperation: (script:context:Token)
> [], ParentContainsErrorRecordException
> + FullyQualifiedErrorId : VariableIsUndefined
> I could not find any information on this online, and I have reproduced
> it on a few machines.
> Note that I get the same error message when running build.ps1 from the
> ISE, which would be nice for debugging purposes.
> Would anyone have any ideas on what could be the cause of this, and
> how to fix it?
> Thanks,
> Romain
> --
> You received this message because you are subscribed to the Google Groups "psake-users" group.
> To post to this group, send email to psake-users@googlegroups.com.
> To unsubscribe from this group, send email to psake-users+unsubscribe@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-users@googlegroups.com.
To unsubscribe from this group, send email to psake-users+unsubscribe@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/psake-users?hl=en.