Wednesday, October 7, 2009

Compiling ASP.NET Applications for Deployment

The process of compiling ASP.NET application is surprisingly simple and available free of cost to all developers. In the same windows folder that contains your asp_regsql.exe and aspnet_regiid.exe applications is a program named asp_compiler.exe. "Sounds reasonable".

So how do you compile with it?
There are several parameters and options that this executable takes to compile an application, however the most basic command to compile an website that will be deployed in the root directory of a new webserver is (I will use the command that I executed on my computer):
C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\aspnet_compiler.exe -p G:\My_Workspace\tobecompiled_CBX -v / G:\My_Workspace\compiled_cbx

In this example, -p refers to the full path to the directory containing the website to be compiled, -v refers to the virtual directory (which is the root directory in this case), and the last directory path (G:\My_Workspace\compiled_cbx) is the folder to which the compiled website will be copied.

Once compiled, you can zip up this new folder and install it on the production webserver. The only requirements is to make the relevat changes in the web.config to get stuff working, for example to connect to the correct database.

Hope this article helps,

Regards

0 comments:

Post a Comment