private Assembly LoadAssembly() { var paths = GetScriptPaths(BaseDirectory).ToArray(); var refAssemblies = ScriptEngines.ReferencedAssemblyNames.ToArray(); var pathDirectory = System.IO.Path.GetDirectoryName(pathToAssembly); var result = ScriptCompiler.CompileFromFile(paths, refAssemblies, AssemblyName, pathDirectory, false); if (!result.Success) { throw new InvalidOperationException("compile error:" + string.Join(Environment.NewLine, result.Diagnostics)); } return(result.Assembly); }