Walkthrough: Deploying an ASP.NET Web Application

Deploying ASP.NET applications is very straightforward. You copy the application files you have created from your development computer to the production Web server that will host your application. You can use the XCOPY command-line tool or your preferred FTP application to copy the files from one location to another.

To deploy assemblies that you want to share across Web applications, such as assemblies that contain custom ASP.NET server controls, deploy them to the global assembly cache. For more information, see Global Assembly Cache. For more information about assemblies, see Programming with Assemblies.

To deploy ASP.NET application files from the command line

  1. Click Start, and then click Run.

  2. In the Open text box of the Run dialog box, enter cmd, and then click OK.

  3. At the command prompt, type the following command:

    xcopy <source path> <destination path>

    In this command, <source path> is the full path to the source files you want to copy, including the drive, directory, and the file names to be copied. You can omit the file names if all files in the directory should be copied. The <destination path> is the full path to the directory where the copied files should be placed.

    The following example command copies all files from the c:\myWebApp directory to the d:\liveapp directory.

    xcopy c:\devapp d:\liveapp
    
  4. Answer any questions you are asked about the files or directory you are copying.

You can use this procedure when you want to update a DLL stored in your application's \Bin directory, or if you want to update any of your other application files. The following example copies a single DLL from a \bin directory on one drive to a \bin directory on another.

xcopy c:\devapp\bin\myAssembly.dll d:\liveapp\bin\

You can use this command to update files in your application once you have deployed it, as well. Although you can copy an entire directory, when copying individual files, you can only copy one file at a time from one directory to another. You can exclude subdirectories, files with a specific file name extension, or specific file names from being copied by using the XCOPY /exclude option. For more information on how to use the XCOPY tool, open the documentation for your operating system and search for XCOPY.

Note   You must use the physical directory names with the XCOPY tool. You cannot use virtual directory names.

See Also

ASP.NET Application Walkthrough | Deploying Applications | Developing a Simple ASP.NET Server Control | Walkthrough: Creating an ASP.NET Web Application Root Directory with IIS | Walkthrough: Creating a Directory Structure for an ASP.NET Web Application | XML Web Services Publishing and Deployment