using System.CodeDom.Compiler;using System.Diagnostics;using Microsoft.CSharp;CSharpCodeProvider preProvider = new CSharpCodeProvider();ICodeCompiler icc = preProvider.CreateCompiler();System.CodeDom.Compiler.CompilerParameters parameters = new CompilerParameters();parameters.GenerateExecutable = false;parameters.OutputAssembly = "AutoGen.dll";CompilerResults results = icc.CompileAssemblyFromSource(parameters, yourCodeAsString);
改编自http://support.microsoft.com/kb/304655
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)