cs-script

How to Add a Reference to a C# Script

半城伤御伤魂 提交于 2020-01-24 04:06:17
问题 I am using the CS-Script library to execute dynamic code. Rather than using it as a script engine, I want to use it to plug functionality into an application on the fly. Here's the hosting code... using System; using CSScriptLibrary; using System.Reflection; using System.IO; namespace CSScriptTester { class Program { static void Main(string[] args) { // http://www.csscript.net/ Console.WriteLine("Running Script."); CSScript.Evaluator.ReferenceAssembly(Assembly.GetAssembly(typeof(System

How to Add a Reference to a C# Script

不想你离开。 提交于 2020-01-24 04:06:01
问题 I am using the CS-Script library to execute dynamic code. Rather than using it as a script engine, I want to use it to plug functionality into an application on the fly. Here's the hosting code... using System; using CSScriptLibrary; using System.Reflection; using System.IO; namespace CSScriptTester { class Program { static void Main(string[] args) { // http://www.csscript.net/ Console.WriteLine("Running Script."); CSScript.Evaluator.ReferenceAssembly(Assembly.GetAssembly(typeof(System

How to pause or stop “CSharpScript” running?

女生的网名这么多〃 提交于 2019-12-12 04:23:22
问题 I'm using Roslyn's scripting API in my application, code snippet as following: public class ScriptEngine { public static string CodeText; public static event Action<string[]> CompileErrorEvent; public static async Task<bool> RunScriptAsync(CancellationToken ct) { try { var scriptResult = await CSharpScript.RunAsync(CodeText, null, new ScriptHost(), null, ct); return true; } catch (Microsoft.CodeAnalysis.Scripting.CompilationErrorException ex) { List<string> result = new List<string>();