.Net 2.0 compilation

A trail of 6 pages, marked with comments, by pXesi
About this trail:
By default, ASP.NET compiles pages and controls on a per-directory level. The compiler takes all pages, controls, and master pages of a given language (C# or Visual Basic .NET) in a directory and compiles them into a single assembly that contains everything that the page or control requires. If you have multiple directories you will have one assembly for each. By default each directory compiles into a separate assembly, but the compiler can also create one assembly per page/control. When running Visual Studio you can use directory-level compilation and every time you make a change in a page or control, the directory-level assembly recompiles. If you make a change in any files in the APP_CODE folder, the APP_CODE assembly also recompiles.
6 marks in this trail
1
By default, ASP.NET compiles pages and controls on a per-directory level. The compiler takes all pages, controls, and master pages of a given language (C# or Visual Basic .NET) in a directory and compiles them into a single assembly that contains everything that the page or control requires. If you have multiple directories you will have one assembly for each. By default each directory compiles into a separate assembly, but the compiler can also create one assembly per page/control. When running Visual Studio you can use directory-level compilation and every time you make a change in a page or control, the directory-level assembly recompiles. If you make a change in any files in the APP_CODE folder, the APP_CODE assembly also recompiles.
2

You can check out the generated class if you run your Web application in debug mode ( in web.config) by looking in your Temporary ASP.NET Files folder in the .NET Framework directory. On my machine, the path looks something like this.

C:\Windows\Microsoft.NET\Framework\v2.0.50727\
 Temporary ASP.NET Files\compilationanddeployment\
 fc448eb9\60feb83a

The directory names below the virtual name will vary for your machine and there may be multiple directories-you have to find the right one by looking at timestamps or simply by looking at file content. In this directory you will find the compiled DLLs for the APP_CODE assembly, as well as any directory-level page and control assemblies that you can inspect with Reflector as shown in Figure 2. Also in this directory will be a set of .cs or .vb files that contain the generated ASP.NET classes that ASP.NET uses to compile the assemblies. The names for these assemblies and source files are randomly based on a hashcode, so you have to open them individually to find the one you’re interested in.

3

Full Pre-Compilation

The most common deployment scenario is full pre-compilation. In this model you use the ASPNET_COMPILER utility or the Web Site Publish feature inside of Visual Studio, which uses the same compilation APIs, to pre-compile your site in its entirety. This means that all markup pages (ASPX/ASCX/MASTER), CodeBeside classes, and all code in the APP_CODE directory are pre-compiled. The compiler takes the existing Web site and publishes the site to a new directory copying all files that relate to the Web sites including static files like images and CSS files. The compiler is essentially generating a complete copy of your Web site outputting a large number of compiled files in the BIN directory.

5
When debugging is off, the JavaScript is cached on the client automatically.

Add your comment: