ScriptCS 0.17.01 Error Unexpected named argument

4.6k Views Asked by At

I tried to run my program using Visual Studio's Coderunner extension as well as from terminal with the scriptcs command.

My code is as follows:

using System;
namespace HelloWorldApplication {
class HelloWorld {
   static void Main(string[] args) {
      Console.WriteLine("hellowol");
   }
}
}

The error message reads:

Unexpected named argument: Users/jfitz/Projects/C#/Projtest/test.cs
2

There are 2 best solutions below

3
VonC On BEST ANSWER

As mentioned in scriptcs/scriptcs issue 1188, this is from a scriptcs bug, which will be fixed in the next release (PR 1289 and commit 9e49b72)

In the meantime, pending the next 0.18 scriptcs release:

The workaround is the following:

instead of doing

mono scriptcs.exe /path/to/foo.csx

do:

mono scriptcs.exe -script /path/to/foo.csx

Jonas suggests in the comments:

For Visual Studio Code, add this to settings.json:

"code-runner.executorMap": { "csharp": "scriptcs -script" }
1
Umair Rehman On

this is the problem of code runner extention. to resolve it click on extentions icon in vs code and select code runner , beside of uninstall button click on setting icon -> extention setting -> find code runner : executor map then click on edit in setting.json . In line 27 replace this "csharp": "scriptcs" by this "csharp": "scriptcs -script"