public CompilerResults Build(string dirWithSrc) { string[] sources = GetSourcesFromDir(dirWithSrc, new string[] { ".cpp", ".h" }); var cppc = new CppCodeProvider(); var parameters = new CompilerParameters(); parameters.OutputAssembly = OutputFile; parameters.GenerateExecutable = Executable; parameters.GenerateInMemory = GenerateInMemory; parameters.IncludeDebugInformation = IncludeDebugInfo; parameters.ReferencedAssemblies.AddRange(IncludedLibraries.ToArray()); parameters.EmbeddedResources.AddRange(EmbeddedResources.ToArray()); parameters.LinkedResources.AddRange(LinkedResources.ToArray()); if (MainClass != null) { parameters.MainClass = MainClass; } CompilerResults results = cppc.CompileAssemblyFromSource(parameters, sources); return(results); }
public CompilerResults Build(string[] sourceCodes) { var csc = new CSharpCodeProvider(new Dictionary <string, string>() { { "CompilerVersion", CompilerVersion } }); var parameters = new CompilerParameters(); parameters.OutputAssembly = OutputFile; parameters.GenerateExecutable = Executable; parameters.GenerateInMemory = GenerateInMemory; parameters.IncludeDebugInformation = IncludeDebugInfo; parameters.ReferencedAssemblies.AddRange(IncludedLibraries.ToArray()); parameters.EmbeddedResources.AddRange(EmbeddedResources.ToArray()); parameters.LinkedResources.AddRange(LinkedResources.ToArray()); if (MainClass != null) { parameters.MainClass = MainClass; } CompilerResults results = csc.CompileAssemblyFromSource(parameters, sourceCodes); return(results); }