title: redirecting output from an external dll in powershell
body: <p>I have a C# assembly that processes an xml file and at the end spits out the results to the console.<br>
  e.g. <code>Console.WriteLine(_header.ToString());</code><br>
  I can load this dll in powershell and call the right method like this:  </p>
  
  <pre><code>[sqlproj_doctor.sqlprojDoctor]::ProcessXML($file) | out-file ./test.xml
  </code></pre>
  
  <p>All is well.  </p>
  
  <p>The problem begins when I want to redirect the output. For some reason stdout is empty. What am I missing? I need to be further process the output of this dll.</p>
  
  <p>Note: If I compile the same code as an executable, it correctly populates the standard output stream and I can redirect the output.</p>
  
  <p>another note: as a workaround, I changed the method from void to string, and can now manipulate the returned string.</p>