Is there finally an easy way to execute a C # script file from the command line?
I saw that github discussion
and according to this topic, I think dotnet run Test.cs should do the job.
But for my test class:
using System; namespace Scripts { public class Program { public static void Main(string[] args) { Console.Out.WriteLine("This is the miracle"); } } }
he fails
PM> dotnet run .\Test.cs dotnet.exe : Object reference not set to an instance of an object.At line:1 char:1
So, how could I execute code in a single file using the command line relatively easily?
UPD 1: As correctly indicated by @Lee and @svick dotnet run to start a project. But my initial question is: how to run a single file. Perhaps some options with roslyn ?
source share