If you're using dotnet core (as it appears from your question), you need to use dotnet to execute code and not csc; that's the compiler for .NET (the nomenclature and weird namings of these things gives me a bit of a headache).
As a gross oversimplification, dotnet core uses a command named dotnet to do compilations and runs of your project, while .NET uses things like msbuild to run builds and uses csc as the underlying compiler. To use those commands you would need to install something like Mono instead (or an official MacOS version of .NET 4 or what have you, assuming such a thing exists).
The build system that I personally use for this sort of thing is:
{
"working_dir": "${folder:${project_path:${file_path}}}",
"selector": "source.cs",
"variants":
[
{
"name": "Build",
"shell_cmd": "dotnet build",
"word_wrap": false,
"quiet": true,
},
{
"name": "Clean",
"shell_cmd": "dotnet clean"
},
{
"name": "Run",
"shell_cmd": "dotnet run"
},
{
"name": "Run Interactive",
"cmd": ["dotnet", "run"],
"target": "terminus_open",
"auto_close": false,
}
],
}
This sets up a build system with several variants, allowing you to choose to build clean or run the program. If you don't choose a variant when you build, the command will fail because the top level build doesn't contain any command to build anything.
In this case that's because of the last variant that uses the Terminus package to allow for running interactive programs. Terminus only supports cmd and I prefer to use shell_cmd, so the top level build needs to have no implicit command.
An alternative to this would be to either ditch the Terminus variant or convert all of the others to use cmd instead. In that case you could move the command for the most common item (say the Run variant) to the top level instead, so that running the program is the default.
As a last note, for the build sysytem to work the presumption is that you're working in a folder where you've use the appropriate dotnet command to create an empty project. I'm not aware offhand if there's a way to execute single ad-hoc C# files using dotnet outside of that context.