The only way that I’ve been able to test whether or not the application is being built with aspnet_compiler is with the following:
HttpRuntime.AppDomainAppId.EndsWith("_precompile")
However, this feels like a hack. I could check against the metabase path, however that can easily be changed with a switch to the executable. Is there a more robust, documented way to determine this?
Here is what I’ve come up with (though it’s still quite dirty). If a better answer is provided, I change it to the accepted answer.