csproj file in Visual Studio import Microsoft.CSharp.targets
which is an MSbuild file which contains the CoreCompile
target to do the compilation. This target uses the CSC task to do the actual compilation, which itself call csc.exe.
You can find the Microsoft.CSharp.targets
file in the framework root directory e.g. C:\Windows\Microsoft.NET\Framework\version\
NAnt has a csc target, so I assume it works in a similar way.