Search code examples
c#.netc#-4.0compiler-errorscodedom

C# compiler verbose output with CodeDomProvider


I have

CompilerResults cr = codeDomProvider.CompileAssemblyFromFile(cp, source);
//where source is an array of source file names

I want verbose output of the compile for each individual file.

Currently I am using a BackgroundWorker to compile and send back error messages, but this happens after the compile is complete. (Success/with errors.)

 foreach (CompilerError ce in cr.Errors)
 {
       synchronizationContext.Send(new SendOrPostCallback((m) =>
       //pushCompilerMessage(currentWindow, msg)
             ), null);                     
 }

All this works fine, but how do pass these messages in such a way that it appears as though in true verbose mode?


Solution

  • "Verbose" doesn't make much sense here. Do you really mean "real time"? Use the BackgroundWorker's ReportProgress method.