Is there at last a easy way to execute c# script file from command line?
I saw that discussion on github
and according to this thread i think dotnet run Test.cs
should do the job.
But for my testclass which is:
using System;
namespace Scripts
{
public class Program
{
public static void Main(string[] args)
{
Console.Out.WriteLine("This is the miracle");
}
}
}
it 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 the code in single file using command line in relatively easy manner?
UPD 1: As correctly mentioned by @Lee and @svick dotnet run
is for running project. But my initial question was - how to run single file. Maybe some options using roslyn
?