using Microsoft.CodeAnalysis.CSharp.Scripting; //you may need to import the namespace from NuGet packages var now = CSharpScript.EvaluateAsync<string>("System.DateTime.Now.ToString()").Result;