Giriş
Şu satırı dahil ederiz.
Şu satırı dahil ederiz.
using System.CodeDom.Compiler;
CompiledAssembly Alanı
var method = compileResult.CompiledAssembly.GetType("ExecClass")
.GetMethod("Exec", System.Reflection.BindingFlags.Static |
System.Reflection.BindingFlags.NonPublic);
method.Invoke(null, invokeArgs);
Errors Alanı
Şöyle yaparız.
if (compileResult.Errors.Count != 0) throw new Exception("Mission failed!");
Şöyle yaparız.var compileResult = new CSharpCodeProvider().CompileAssemblyFromSource(...);
if (compileResult.Errors.HasErrors)
{
foreach (CompilerError ce in compileResult.Errors)
{
if (ce.IsWarning) continue;
Console.WriteLine("{0}({1},{2}: error {3}: {4}",
ce.FileName, ce.Line, ce.Column, ce.ErrorNumber, ce.ErrorText);
}
}
Hiç yorum yok:
Yorum Gönder