Compile and deploy an application using aspnet_compiler
I’d a need to compile and to deploy a compiled version of an ASP.Net web site to a directory that the web site is published. For this purpose, I’ve decided to use an utility from .Net Framework 2.0 named aspnet_compiler.exe. It is located in <windows_directory>\Microsoft.NET\Framework\ v2.0.50727. The advantage of using it is that I can compile the web site and to deploy it using a bat file and the web site will be compiled. It will prevent the delay that an end-user can experience when accesses the site for the first time. I use the following command line to compile and deploy the web site to the host
C:\Program Files\Microsoft Visual Studio 9.0\VC>aspnet_compiler -v "/website" -p website_physical_path -f target_path -c
Note that I use -c switch of the tool. It will enforce the tool to compile the application by full rebuilt. If the switch is omitted, the tool builds only those part of the application that were recently modified.
In addition, you can also use this tool to compile the application in-place. It is useful when you have made changes on the site of published web site and you’d like to enforce web site compilation.
Compiling an Application in Place
The ASP.NET Compilation tool can compile an application in place, that is, it mimics the behavior of making multiple requests to the application, thus causing regular compilation. Users of a precompiled site will not experience a delay caused by compiling the page on first request.
For more information about aspnet_compiler.exe you can visit this MSDN article.
Leave a Reply