I think you should use CodeCompiler for that purpose. There is no need in Reflection or shelling out csc as all the required support is already provided within .net framework.
Check out the Microsoft Support article: "How to programmatically compile code using C# compiler". Also take a look at the "System.CodeDom.Compiler" namespace at MSDN.
Also you will need to perform some googling in order to find samples that suite your needs. Code generation had been discussed a lot so you won't have problems finding samples.
You might be also interested in automating of your source code generation so T4 is also worth looking at. Refer to Oleg Sych blog to find out all details towards T4 generation.