At present the ScriptCS session does not live past the currently executing pipeline. Example:
> invoke-scriptcs 'var s = 0';
> invoke-scriptcs 's'
Invoke-ScriptCS : (1,78): error CS0103: The name 's' does not exist in the current context
At line:1 char:44
+ invoke-scriptcs 'var s=0;'; invoke-scriptcs <<<< 's'
+ CategoryInfo : NotSpecified: (:) [Invoke-ScriptCS], CompilationErrorException
It would be nice if the ScriptCS session lived longer than this. I'm not sure if having a single ScriptCS session live for the length of the PowerShell session is the answer, or whether a New/Start/Exit/Get-ScriptCSSession cmdlet family (a la PSSession) is the better option:
> enter-scriptcsSession -name 'mysession'
> invoke-scriptcs -session mysession -script 'var s=0;'
> invoke-scriptcs 's'
0
>exit-scriptscSession mysession
> invoke-scriptcs 's'
Invoke-ScriptCS : (1,78): error CS0103: The name 's' does not exist in the current context
At line:1 char:44
+ invoke-scriptcs 'var s=0;'; invoke-scriptcs <<<< 's'
+ CategoryInfo : NotSpecified: (:) [Invoke-ScriptCS], CompilationErrorException
At present the ScriptCS session does not live past the currently executing pipeline. Example:
It would be nice if the ScriptCS session lived longer than this. I'm not sure if having a single ScriptCS session live for the length of the PowerShell session is the answer, or whether a New/Start/Exit/Get-ScriptCSSession cmdlet family (a la PSSession) is the better option:
I'm in tinker mode, and am open to input.