ScriptCS 0.17.01 Error Unexpected named argument

北慕城南 提交于 2021-02-19 03:39:38

问题


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

回答1:


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" }


来源:https://stackoverflow.com/questions/51924614/scriptcs-0-17-01-error-unexpected-named-argument

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!