问题
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