public static string compileIntoDll_inFolder(this string fileToCompile, string targetFolder) { "Compiling file: {0} ".debug(fileToCompile); //var fileToCompile = currentFolder.pathCombine(file + ".cs"); var filenameWithoutExtension = fileToCompile.fileName_WithoutExtension(); var compiledDll = targetFolder.pathCombine(filenameWithoutExtension + ".dll"); var mainClass = ""; if (fileToCompile.fileExists().isFalse()) "could not find file to compile: {0}".error(fileToCompile); else { var assembly = new CompileEngine().compileSourceFiles(new List<string> {fileToCompile}, mainClass, filenameWithoutExtension); if (assembly.isNull()) "no compiled assembly object created for: {0}".error(fileToCompile); else { Files.Copy(assembly.Location, compiledDll); "Copied: {0} to {1}".info(assembly.Location, compiledDll); if (compiledDll.fileExists().isFalse()) "compiled file not created in: {0}".error(compiledDll); else return compiledDll; } } return null; }
public static Process console_Run(this API_NUnit nUnitApi, string target, string extraStartupOptions, Action<string> consoleOut) { if (target.extension(".cs")) { var assembly = new CompileEngine().compileSourceFile(target); if (assembly.isNull()) { "[API_NUnit][console_Run] failed to compile C# file: {0}".error(target); return null; } target = assembly.Location; } var startUpOptions = "\"{0}\" {1}".format(target ?? "" , extraStartupOptions ?? ""); return nUnitApi.executeNUnitConsole(startUpOptions , consoleOut); }