csc
will always write the output into the current working directory unless you specify a different output location with the /out
flag.
So it won't work if you don't have write access to the current working directory, unless you specify /out
(or change the working directory via ProcessStartInfo.WorkingDirectory
). If you're happy with it writing to the working directory, then that's where you should look for the result.
Additionally, as noted by Hans Passant in comments, you should consider other programmatic ways of generating code:
CSharpCodeProvider
- The Roslyn API, which is currently in CTP, but which is the next-generation managed C# compiler, which will be the basis of Visual Studio in the future.