On the DOTNET-LANGUAGE-DEVS mailing list, I posted a question about why there was a cscomp.dll even though the frameworks don’t use it directly. I just double-checked today, and the only folks that use cscomp.dll is VS.NET. You can verify this for yourself by running PROCEXP on your computer.
The ASP.NET folks elected not to use cscomp.dll so that they could sandbox the compilation process. Here’s the answer from Grant Richins at MS (via Lars Bergstrom):
“Cscomp.dll is loaded in-process for the IDE scenario. He is correct that avoiding the call to CreateProcess would save some time, but by running the compiler out-of-process, ASP.NET is able to isolate itself even better by giving the compiler process very few privileges (at one point the compiler couldn’t even write to the temp directory!). Also any exception that happens in the compiler is completely isolated to the compiler process and has no way to bring down all of ASP.NET.
We had considered exposing a managed in-process C# compiler for ASP.NET and the CodeDom. In fact we even wrote the code (see Microsoft.CSharp.Compiler), but when ASP.NET and the CodeDom decided not to use it, we decided to deprecate it. Its only real savings (besides the unneeded CreateProcess) was that it could compile source code passed in as strings and thus not cause file I/O, but I’m not sure if that savings wasn’t swallowed up by the cost of interop. We wanted to remove it entirely because we didn’t have good test coverage for it, but too late in our ship cycle we discovered some other teams had introduced dependencies on this interface unbeknownst to us. So we recommend customers don’t use it because we are planning on ripping it out in a few versions.”