dotnet scrips
Install dotnet script
dotnet tool install -g dotnet-script
Write csx script file with nuget package reference
// script.csx
#r "nuget:Newtonsoft.Json, 13.0.1"
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
var args = Environment.GetCommandLineArgs();
if(args.Any(a => a == "--dry-run"))
{
return;
}
Console.WriteLine("Using Newtonsoft.Json to parse JSON.");
var json = JObject.Parse(@"{ 'name': 'John', 'age': 30 }");
Console.WriteLine(json["name"]);
Run script
dotnet-script script.csx