static Assembly Compile(string path, bool debug) { //See manual to get further information about compilation and options. ISource code = new FileSource(path); Assembly asm; using (Stream dll = new MemoryStream()) using (Stream pdb = new MemoryStream()) //using (Stream icon = File.OpenRead(GetFilePath(@"..\..\VsExtension\JellequinVs2017.ProjectType\Jellequin.ico"))) { Compiler.Compile(code.GetText(), new AssemblyName("JquariumJell") { Version = new Version(1, 2, 3, 4) }, new CompilerOptions { FileKind = FileKind.ConsoleExe, RuntimeMethodsUsage = RuntimeMethodsUsage.Call, //DontUseDynamicJsMembers = true, Debug = debug }).Save(dll, new SaveOptions { /*Icon=icon,*/ Symbols = new SymbolsSaveOptions { Code = code, EmbedSource = false, Pdb = pdb } }); //Generated assembly and debug symbols might be stored to files... string basePath = GetFilePath(Path.Combine("out", "jquarium.")); dll.Position = 0; using (Stream s = File.Create(basePath + "dll")) dll.CopyTo(s); pdb.Position = 0; using (Stream s = File.Create(basePath + "pdb")) pdb.CopyTo(s); //...and/or loaded into application context and used dll.Position = 0; pdb.Position = 0; asm = System.Runtime.Loader.AssemblyLoadContext.Default.LoadFromStream(dll, pdb); } return(asm); }