This documentation is archived and is not being maintained.

Compilation and Deployment of Web Projects

Visual Studio .NET 2003

When using Visual Studio .NET to create ASP.NET Web applications, you use a standard deployment model: your project is compiled and the resulting files are deployed. The Web Forms code-behind class file (.aspx.vb, or .aspx.cs), but not the .aspx file, is compiled into a project .dll file along with all other class files included in your project. This single project .dll file is then deployed to the server, without any source code. When a request for the page is received, the project .dll file is instantiated and executed.

Note   For more information about how Web Forms pages are compiled, see Web Forms Code Model.

An implication of this model is that you can change the .aspx file after the project is built, but you cannot change the code in the class file without recompiling. In other words, you can change visual elements of your Web Forms pages without the need for recompiling and redeploying.

Security Note   At design time in Visual Studio, your code in your project always runs fully trusted. This has two implications. The first is that you can potentially run unsafe code by importing it into your project and running it as fully trusted. The second is that code in your project might work properly when you are testing it on your own computer, but might fail due to lack of adequate permissions in a deployed application. For more information, see Code Access Security.

Compiling and Deploying an ASP.NET Web Application Project

Suppose you have a simple ASP.NET Web application project called WebApplication1 that contains the following:

  • A Web Forms page called WebForm1.aspx.
  • Some additional modules containing business logic, written in the language of your choice, called BusinessLogic1 (.vb or .cs) and BusinessLogic2 (.vb or .cs).

You have edited the Web Forms page and are ready to compile the project. The following occurs when you compile it:

  • All files in the project that have been modified since the last build are saved.
  • The WebForm1.aspx file and default project files are copied to the Web server.
  • The WebForm1 class file (.aspx.vb or .aspx.cs), BusinessLogic1 component, and BusinessLogic2 component are compiled into the project .dll file, which is copied to the server in the default \Bin directory of the target virtual directory.
    Note   If there are compilation errors, the deployment will not succeed. For more information on compiling an ASP.NET Web application project, see Compiling and Running Web Forms Pages. For more information on deployment, see Deploying Applications and Components.

See Also

Compiling and Running Web Forms Pages

Show: