Compliation techniques in asp.net 2.0

Automatic Compilation
ASP.NET automatically compiles your application code and any dependent resources the first time a user requests a resource from the Web site. In general, ASP.NET creates an assembly for each application directory (such as App_Code) and one for the main directory. (If files in a directory are in different programming languages, then separate assemblies will be created for each language.) You can specify which directories are compiled into single assemblies in the Compilation section of the Web.config file.
Flexible Deployment
Because ASP.NET compiles your Web site on first user request, you can simply copy your application's source code to the production Web server. However, ASP.NET also provides precompilation options that allow you to compile your Web site before it has been deployed, or to compile it after it has been deployed but before a user requests it. Precompilation has several advantages. It can improve the performance of your Web site on first request because there will be no lag time while ASP.NET compiles the site. Precompiling can also help you find errors that might otherwise be found only when a user requests a page. Finally, if you precompile the Web site before you deploy it, you can deploy the assemblies instead of the source code.
You can precompile a Web site using the ASP.NET compiler tool (ASPNET_Compiler.exe). The tool that provides the following precompilation options:
In-place compilation This option performs the same compilation that occurs during dynamic compilation. Use this option to compile a Web site that has already been deployed to a production server.
Non-updateable full precompilation Use this to compile an application and then copy the compiled output to the production server. All application code, markup, and UI code is compiled into assemblies. Placeholder files such as .aspx pages still exist so that you can perform file-specific tasks such as configure permissions, but the files contain no updateable code. In order to update any page or any code you must precompile the Web site again and deploy it again.
Updateable precompilation This is similar to non-updateable full precompilation, except that UI elements such as .aspx pages and .ascx controls retain all their markup, UI code, and inline code, if any. You can update code in the file after it has been deployed; ASP.NET will detect changes to the file and recompile it. Note that code in a code-behind file (.vb or .cs file) built into assemblies during precompilation, and you therefore cannot change it without going through the precompilation and deployment steps again.

Extensible Build System
ASP.NET uses BuildProvider classes to build items such as .aspx pages, .ascx files, and global resources. You can extend and customize the ASP.NET build system to compile custom resources by creating classes that inherit from the BuildProvider class. For example, you could add a new file type and then write a BuildProvider that builds that particular type.

Popular Posts