public static CompileResult Compile( IEnumerable <string> filenames, string assemblyName, string compilerOptions = "" ) { var extension = Path.GetExtension(filenames.First()).ToLower(); Func <CodeDomProvider> provider = null; switch (extension) { case ".cs": provider = () => new CSharpCodeProvider(new Dictionary <string, string>() { { "CompilerVersion", "v4.0" } }); break; case ".vb": provider = () => new VBCodeProvider(new Dictionary <string, string>() { { "CompilerVersion", "v4.0" } }); break; case ".fs": provider = () => { var result = new FSharpCodeProvider(); return(result); }; break; case ".il": provider = () => { var result = new CILCodeProvider(); return(result); }; break; case ".cpp": provider = () => { var result = new CPPCodeProvider(); return(result); }; break; default: throw new NotImplementedException("Extension '" + extension + "' cannot be compiled for test cases"); } return(Compile( provider, filenames, assemblyName, compilerOptions )); }
public static CompileResult Compile ( IEnumerable<string> filenames, string assemblyName, string compilerOptions = "" ) { var extension = Path.GetExtension(filenames.First()).ToLower(); Func<CodeDomProvider> provider = null; switch (extension) { case ".cs": provider = () => new CSharpCodeProvider(new Dictionary<string, string>() { { "CompilerVersion", "v4.0" } }); break; case ".vb": provider = () => new VBCodeProvider(new Dictionary<string, string>() { { "CompilerVersion", "v4.0" } }); break; case ".fs": provider = () => { var result = new FSharpCodeProvider(); return result; }; break; case ".il": provider = () => { var result = new CILCodeProvider(); return result; }; break; case ".cpp": provider = () => { var result = new CPPCodeProvider(); return result; }; break; default: throw new NotImplementedException("Extension '" + extension + "' cannot be compiled for test cases"); } return Compile( provider, filenames, assemblyName, compilerOptions ); }