using Microsoft.CSharp; using System.CodeDom.Compiler; namespace IntelligentControlForsx.CodeGenerator { public class CodeCompiler { public static CodeCompilerResults CompileModelCode(string clsName, string[] varArray) { CodeDomProvider cpd = new CSharpCodeProvider(); CompilerParameters cp = new CompilerParameters(); cp.ReferencedAssemblies.Add("System.dll"); cp.ReferencedAssemblies.Add("GdxnyWindTurbineContorls.exe"); cp.GenerateExecutable = false; string sourceCode = CodeGenerator.Generate(clsName, varArray); CompilerResults cr = cpd.CompileAssemblyFromSource(cp, sourceCode); return new CodeCompilerResults(cr); } } }