All you really need to do is have your program create a .cs source file with the source you want and run it through the command line compiler.
csc.exe (Microsoft's compiler)
You can also use CodeDom to access the C# compiler from code.
If you absolutely must have an entire .NET project, make a minimal .csproj file and use that as a template. You can build them with msbuild or XBuild.