I’ve been using MonoDevelop and Make to execute some build taks on a C project under linux, but I decided to abandon Make and switch to NAnt since I am more proficient in writing C# programs than Make/shell scripts, so I decided to write a custom NAnt task in C# to replace my Makefile. So, how can I invoke GCC or other shell commands from C#?
I also need to know how to block the execution until GCC returns.
It’s the same as on Windows – use System.Diagnostics.Process. Beware that if you redirect stdout/stderr and the buffers fill up (which is entirely possible using GCC) it can deadlock, so harvest those into StringBuilders.
FWIW, you might like to consider using custom tasks for MSBuild (i.e. Mono’s “xbuild”) instead of NAnt, because MonoDevelop’s project files are MSBuild files, and MonoDevelop has xbuild integration.