The pre-compilation tool of ASP.Net 2.0 does this and also improves upon the start-up time of the application. With pre-compilation you will observe that there are no files with visible source code. Among the source code only .aspx pages exist physically, which are also without any sort of code (including html). If you happen to open anyone of them in notepad, you will see this text, "This is a marker file generated by the pre-compilation tool, and should not be deleted!” In the following information this has been explained:
- Open the command prompt and type following command.
aspnet_compiler -p "C:\MyApplication\WebSite1" -fixednames -u -f C:\MyStaging
In this command there are few important switches which need explanation:
i) Aspnet_compiler : This is .net framework utility to pre-compile the application.
ii) -p : This switch specifies the physical path of the application. In our case this is specified as, C:\MyApplication\WebSite1
iii) – fixednames: Pre-compilation generates unique filename for certain assemblies in the bin folder, and this may change on every pre-compilation. This could mean that there may be extra files on server if you keep copying the pre-compiled set of files from the development environment. To avoid this, use switch –fixednames to generate same assemble names on every pre-compilation.
iv) –u: At times you want that the presentation files (such as aspx,ascx,ashx,MASTER), which contains the html code, remains modifiable so that necessary cosmetic changes may be carried out whenever needed. –u switch helps achieve the same. You can deploy these files to the server and modify them without causing an error, because the ASP.NET runtime will dynamically parse and compile these files.
On the contrary, in absence of this switch, these files will not contain any content, and if anyone happens to open them, following text will be found "This is a marker file generated by the pre-compilation tool, and should not be deleted!”
v) -f: This switch will force the compile to overwrite the target directory.
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. 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. However, the variety of switches are not available here, and recommendation is to go for this utility.
---------------------------------------------------------------------------------------------------------------
If this helps, 'Mark' this as answer so that post appears as closed.