4

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
SSteve
  • 10,550
  • 5
  • 46
  • 72
jamesfdearborn
  • 769
  • 1
  • 10
  • 26

2 Answers2

7

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" }
Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • For **Visual Studio Code** add this to `settings.json` `"code-runner.executorMap": { "csharp": "scriptcs -script" }` – jonas Dec 04 '19 at 12:11
  • @jonas Thank you. I have included your comment in the answer for more visibility. – VonC Dec 04 '19 at 12:51
  • Small note that it take me some time in debian (and i assume most of linux systems) the file is located at ~/.config/Code/User – Guillermo Gutiérrez Dec 21 '19 at 10:09
0

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"

  • Based on vonc's answer, it seems this is not an extension issue but a scriptcs version issue. Can you cite your source (which will help elaborate this detail)? – ryanwebjackson Jun 28 '23 at 12:01