I found this really well-done example of how to programatically compile code at:
I wanted to make one small modification; instead of outputting the error to Console, I wanted to use MessageBox. I added the reference "using System.Windows.Forms;" right after the using System reference.
When I ran the build, I got this exception: Line number 2, Error Number: CS0234, 'The type or namespace name 'Windows' does not exist in the namespace 'System' (are you missing an assembly reference?);
How can I get the compile to add this reference to the compile?