Tuesday, June 9, 2009

Steps in Compliation in ASP.NET

We all know the term compilation in Asp.Net. But do you know what is the order of compilation in an asp.net project. Do you know which folder in the application structure gets compiled first and which when get compiled last?

Here is the compilation life cycle of an Asp.Net project in the order they get compiled.

App_GlobalResources: First of all the global resources are compiled and the resource assembly is built. All the assembly's in the bin folder are linked to this assembly.

App_WebResources: Next the web resource folder will be compiled. This will create all the proxy types for the web services. The web reference created is then linked to the resource assembly (if it exists.).

Profile properties (defined in the Web.config file): If we have defined the profile properties in the web.config file than an assembly will be generated for the profile objects.

App_Code: Next all the files in the App_Code folder will be compiled. All code assemblies and the profile assembly are linked to the resources and Web references assemblies if any.

Global.asax: Next the Application object is compiled and then it is linked with all other previously generated assembly's.

Once the top-level items are compiled, the compilation of folder, pages and other items start as and when needed. Here is a list of how this process continues?

App_LocalResources: If the folder containing the requested item contains an App_LocalResources folder, the contents of the local resources folder are compiled and linked to the global resources assembly.

Individual Web pages (.aspx files),
User Controls (.ascx files),
HTTP handlers (.ashx files),

HTTP modules (.asmx files): Next these files are compiled.

Themes, master pages, other source files are compiled when referenced page is compiled.

No comments: