Precompilation in ASP.NET 2.0
page 4 of 4
by Scott Allen
Average Rating: This article has not yet been rated.
Views (Total / Last 10 Days): 39053/ 74

Miscellany and Wrap Up

A few other features of the aspnet_compiler include the –d switch, which tells the compiler to generate debugging symbols for the application. Debugging symbols are required if you need line numbers in the stack traces of exceptions. The –f switch will force the compiler to overwrite a target directory, even if a precompiled application already exists there. There are also options to give compiled assemblies a strong name, and allow partially trusted callers.

In addition, you can pre-compile an application directly from Visual Studio 2005 using the Build -> Publish menu item. The Publish Web Site dialog will let you select an http, ftp, or local file system destination as the target.

The precompiler also supports strong naming with the -keyfile, -keycontainer, and -delaysign switches. To allow partially trusted callers, use the -aptca switch.

Although performance is often touted as a benefit of pre-compilation, I tend to think of pre-compilation as a safety feature. Safety in knowing all of the code in a web application compiles without an error, and safety in keeping your source code out of a shared host environment.

View Entire Article

User Comments

Title: Issue releated to user controls   
Name: Hitendra Patel
Date: 2008-06-09 5:14:03 AM

Article is good but still the information which I required, that is not here.

I have searched on any sites but nowhere I get.

Issue is , I have may usercontrols which are having custom event and also contain other user controls (as a child control). When I'm using per-compilation option, its not able to find out dependent controls and that makes compilation fail.

I could able to build the project in VS2005 and site is also working with error but precompilation is not able to find out proper reference of used usercontrol or customer control.

FYI, I have paste error here.
cx(10): error CS0117: 'ASP.usercontrols_leftpanel_ascx' does not contain a definition for 'ReportNodeClicked'

actually this control is loaded by one of the aspx page and same event is written in codebehind file of that page.

Pl help me to resolve this issue if any one can.

Title: Bad feature   
Name: RM
Date: 2007-05-18 11:23:54 AM
While it might be useful in some situations, this is a very bad feature to have enabled by default.

I've been trying for eons to find out how I can go back to the normal way of publishing so I can update some HTML in the aspx files without having to recompile and republish the WHOLE site, which is very counter productive.
Title: partial deployment   
Name: kiht
Date: 2007-03-22 3:06:58 AM
So if I have to update just 1 aspx.cs file, do I need to precompile and copy the whole bin folder on production?
Or is it possible just to deploy one particular dll. Would be helpful if you let me know.
Title: Very good   
Name: Bas
Date: 2006-11-13 3:27:09 PM
I was pretty frustrated by the initial slowness of 2.0, but this precompiling solves it all!

Thanks for sharing!
Title: Great!!   
Name: Diego Moreno
Date: 2006-07-17 1:46:53 PM
Nice job!!, i found this information very usefull, nice examples too
Title: Thank the stars   
Name: Eben Roux
Date: 2006-05-06 2:50:18 AM
Hi Scott,

I have been updating my sites from ASP 1.1 to 2.0 and have started thinking that the version 2 implementation may have been a slight strategic error on Microsoft's part... but as usual it boils down to knowing the tool. I was struggling to understand how things should be compiled and where they should go. Even tried the WAP stuff and that gave me some more headaches.

Your simple article has really helped. Thanks for that.

Title: Great job   
Name: Chris Holmes
Date: 2006-01-05 1:21:22 PM
Thanks for the article Scott. This was just what I needed.

We just converted a small internal web app from ASP 1.1 to ASP 2.0. I was shocked to find out that I had to copy the actual codeFiles (.cs) to my web directory in order to get the applicationt to run properly. I don't know about anyone else, but the idea that my raw source files are located on the webserver scared me to death.

Fortunately, your article explained the other methods for deployment in clear detail. We precompiled our site and deployed it with VS.NET 2005's GUI version of the command-line tool.

So thanks for posting this!
Title: Thanks   
Name: Scott Allen
Date: 2005-12-21 4:44:16 PM
Thanks, Ahmet.
Title: very useful info   
Name: Ahmet KUCUK
Date: 2005-12-19 4:20:42 PM
especialy 2.0 express edition doesnt have gui tool
for compiled publishing.
so that compilation commands and techniques is very useful information.
Title: Re: Can we also deploy user controls...   
Name: Scott Allen
Date: 2005-11-01 11:38:57 PM
Deployable user controls are possible in ASP.NET 2.0. Take a look at this article on my blog:, and also check out the comments where I have some other links.
Title: Can we also deploy user controls (.ascx) files in this way.   
Name: Umut Tezduyar
Date: 2005-11-01 5:30:04 PM
For example, i have written a custom control, that has .ascx extension and i want to publish this control as a reusable component for other developers. Can precompile also work in this scenario.
Title: Nice work   
Name: Kenneth
Date: 2005-10-24 7:45:07 PM
very touchy and helpful article for webmasters who deploy their code in shared host.

Would be nice to see some in-action examples.
Title: Great!   
Name: Kalyan Kumar
Date: 2005-09-24 10:45:05 AM
This article clearly explains about Precompilation techniques in ASP.NET 2.0.

Good Work!Keep it up!!!!
Title: Thanks   
Name: Murugan JK
Date: 2005-09-24 10:43:12 AM
Thanks for this solution. It's an outstanding compilation techniques.

Keep it up!
Title: Precompilation in ASP.NET 2.0   
Name: Adams
Date: 2005-09-24 10:41:10 AM
Great Article!, i need to clarify, what about our previous deployment methodologies?
Title: Precompilation in ASP.NET 2.0   
Name: sateesh
Date: 2005-09-22 3:33:34 PM
Nice article...fantasic!!
Title: excellent   
Name: Stefan
Date: 2005-09-20 12:15:58 AM
Nice Article!

Product Spotlight
Product Spotlight 

Community Advice: ASP | SQL | XML | Regular Expressions | Windows

©Copyright 1998-2020  |  Page Processed at 2020-08-03 10:40:19 PM  AspAlliance Recent Articles RSS Feed
About ASPAlliance | Newsgroups | Advertise | Authors | Email Lists | Feedback | Link To Us | Privacy | Search