0

I'm on Linux and currently trying to run a simple Hello World-program in C# using visual studio code. The VSC for Linux, Arch Linux to be precise, is 'code'. I installed the extension 'Code Runner', but everytime I click on the 'Play/Execute'-Button in the upper right corner, it says:

[Running] cscript "/path/to/my/file/learning.cs"
/bin/sh: cscript: command not found

I can compile it with csc learning.cs and executing it with mono learning.exe just fine, but the built in code-runner VSC extension does not seem to work. I thought about adding 'cscript' to PATH but I don't know where it is located at. I read on here that this problem exists for quite some time now, maybe someone found a solution? Or I am just really blind or dumb for not seeing an obvious fix. Any help is greatly appreciated.

user692942
  • 16,398
  • 7
  • 76
  • 175
Moth999
  • 1
  • 1
  • I'm guessing this is because you won't have access to `cscript.exe` through a Linux Shell. Is code-runner designed to run in Linux? But also you wouldn't call `cscript` to execute [tag:c#] it's for Active Scripting languages like [tag:vbscript] and [tag:jscript]. – user692942 Aug 27 '20 at 20:07

1 Answers1

0

Fix: in vscode, go to preferences, then settings. Type Code-runner: Executor Map Click Edit in settings.json

Under "code-runner.executorMap":

replace

csharp: cscript

with

csharp: dotnet run
Moth999
  • 1
  • 1