简体   繁体   中英

Can you specify if aspnet_compiler.exe creates a debug or release build?

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_compiler tool 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_compiler to 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 true to false or vice versa, and watch what ASP.NET does. At least, with dynamic compilation, a recycle will recompile using the updated value.

Precompilation is compilation, if you precompile in debug mode you cannot revert to release.

Changing <compilation debug="true|false"> at runtime depend on your precompilation mode : deployment only or deployment and update .

deployment only : All files will be precompiled and debug will have no effects on them.

deployment and update : .asmx, .ashx, App_Themes, App_LocalResources will be "as is" and compiled on first access. Note that aspx can be updated in this mode.

Check this out : <compilation debug="XXX in web config, what scenarios does it affect?

Have you looked into the power tool Web Deployment Projects? This tool gives you a lot of flexibility for your builds, and even works with automated TFS builds.

Here is a link to the new version of WDP for VS2010.

One key point is that there are two completely different ways to precompile a site: in-place, or for deployment. If your goal is simply to make startup faster, then precompiling in-place makes more sense. Not clear whether that's already what you are doing.

You can run aspnet_compiler -? to get examples. In-place simply looks like this:

aspnet_compiler -v /MyApp

That it, it doesn't create a new deployment folder. Instead, it basically acts as if all the pages in your site are being requests, so that they won't have to be compiled at runtime.

As far as debug mode, there is no difference between in-place precompilation and regular runtime. That is, it honors the standard web.config flag, as well as the debug flag in aspx pages. So if you change the flag in config after precompilation, the site will be recompiled at runtime (unless you run aspnet_compiler again!)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM