I wish to compile my asp.net MVC application using aspnet_compiler.exe from the comandline to speed up cold startup.
I’m wondering how it determines if it should do a release or debug build. Is it always release? Does it depend on what the web.config file says when you run aspnet_compiler.exe?
What happens to an application that’s been compiled w/ aspnet_compiler.exe if someone changed the debug attribute in the web.config file after it has been published?
Any clarification on this would be greatly appreciated.
The
aspnet_compilertool determines if it should build a debug or release build depending on the<compilation debug="true|false">setting in your web.config file.You can force
aspnet_compilerto produce debug output regardless of this setting by passing the -d flag when invoking.You can also override the
<compilation debug="true|false">in machine.config by changing the<deployment retail="true|false"/>option. Setting this to true will force release builds regardless of the setting in web.config. See here for more info.Note also from this article that you should always set debug to false before deploying, due to the overhead it creates even when using a release build.
I am unsure of whether or not the aspnet_compiler.exe picks up on a change of the web.config file at runtime, but you can test this easily by creating a test application, deploying it, changing the option from
truetofalseor vice versa, and watch what ASP.NET does. At least, with dynamic compilation, a recycle will recompile using the updated value.