Vscode-code-runner: Error with scriptcs

Created on 2 Jan 2017  ·  6Comments  ·  Source: formulahendry/vscode-code-runner

Hi @formulahendry

As mentioned in the readme I've installed the scriptcs extension and it works fine on the terminal for the *.csx scripts but it's not the same with run code command in VsCode.

Console.WriteLine("Hello C#")

The above displays the expected output with scriptcs scratch.csx but inside VsCode it raises the following error

[Running] scriptcs "/Users/eklavya/Projects/Amsterdam/RosettaCode/scratch.csx"
Unexpected named argument: Users/eklavya/Projects/Amsterdam/RosettaCode/scratch.csx
Usage: scriptcs options

   OPTION                    DESCRIPTION                                                                                     
   -ScriptName (-script)     Script file name, must be specified first                                                       
   -Repl (-R)                Launch REPL mode when running script. To just launch REPL, simply omit the 'script' argument.   
   -Help (-?)                Displays help                                                                                   
   -Debug (-D)               Emits PDB symbols allowing for attaching a Visual Studio debugger                               
   -Cache (-C)               Flag which determines whether to run in memory or from a .dll                                   
   -LogLevel (-log)          Flag which defines the log level used.                                                          
   -Install (-i)             Installs and restores packages which are specified in packages.config                           
   -Global (-g)              Installs and restores global packages which are specified in packages.config                    
   -Save (-S)                Creates a packages.config file based on the packages directory                                  
   -Clean (-Cl)              Cleans installed packages from working directory                                                
   -AllowPreRelease (-pre)   Allows installation of packages' prelease versions                                              
   -Version (-V)             Outputs version information                                                                     
   -Watch (-W)               Watch the script file and reload it when changed                                                
   -Modules (-M)             Specify modules to load                                                                         
   -Config (-Co)             Defines config file name                                                                        
   -PackageVersion (-P)      Defines the version of the package to install. Used in conjunction with -install                
   -Output (-O)              Write all console output to the specified file                                                  

   EXAMPLE: scriptcs server.csx -logLevel debug
   Executes the 'server.csx' script and displays detailed log messages. Useful for debugging.



[Done] exited with code=1 in 0.302 seconds
external

Most helpful comment

For quick workaround, you could try below settings in 'User Settings' of VS Code to avoid using full file path:

"code-runner.executorMap": 
{ 
"csharp": "cd $dir && scriptcs $fileName" 
}

All 6 comments

The filename being in quotations seems to be the problem - could you tell me how to correct this.

Happy new year 😄

Seems like it is scriptcs issue, refer to this. Could you please run scriptcs "/Users/eklavya/Projects/Amsterdam/RosettaCode/scratch.csx" in terminal. If the issue also exists in terminal, please upgrade scriptcs and try again.

Okay, I've reported the issue over at the scriptcs repo, - it's odd that the issue would come up in 0.16.1 version.

For quick workaround, you could try below settings in 'User Settings' of VS Code to avoid using full file path:

"code-runner.executorMap": 
{ 
"csharp": "cd $dir && scriptcs $fileName" 
}

Yup, this was essentially an external issue. I needed to change the settings of the code runner plugin.

It seems scriptcs 0.17.1 has not yet fixed the problem lol.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

sstorey-nephila picture sstorey-nephila  ·  5Comments

mjaniec2013 picture mjaniec2013  ·  5Comments

nmchgx picture nmchgx  ·  3Comments

ranolfi picture ranolfi  ·  3Comments

eegod picture eegod  ·  5Comments