Share via


Walkthrough: Deploying a Web Site Project by Using XCOPY

You can use the XCOPY command-line tool to copy the files of a Web site project from your development computer to the Web server that will host your site. The files that you copy can either be the source files (if you do not precompile the site) or the precompiled assemblies and related files.

If you were deploying a site to production, you might want to prevent the production site from responding to page requests during the deployment process, to avoid errors that might result during the time when changes are in progress. Also, you might want to make sure that the application domain does not recycle multiple times during deployment. This walkthrough does not cover these tasks. For more information, see How to: Prepare to Deploy a Web Project.

Note

This topic applies only to Web site projects. For information about the difference between Web application projects and Web site projects, see Web Application Projects versus Web Site Projects in Visual Studio.

Prerequisites

In order to complete this walkthrough, you need:

  • An ASP.NET Web site project.

  • A destination that is accessible using a file path or UNC path, on a server that has IIS and ASP.NET installed.

To deploy an ASP.NET Web site using XCOPY from the command line

  1. Open a Windows command prompt. (For example, click Start and then enter Cmd.)

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

    xcopy /I /S <source path> <destination path>
    

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

    In this example, <source path> is the full path to your Web site project, and <destination path> is the full path to the directory where the project will be deployed.

    The /S parameter copies all subdirectories and the files they contain.

    The /I parameter indicates that a directory is being copied. If the destination folder does not exist, XCOPY creates one.

    The following example command copies all files from the c:\inetpub\wwwroot\devapp directory to the d:\publicsites\liveapp directory.

    Xcopy /I /S c:\inetpub\wwwroot\devapp d:\publicsites\liveapp
    
  3. The command might pause for you to answer a question such as "Overwrite filename (Yes/No/All)?" for which you can type your answer.

    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 and parameters, see Xcopy in the Windows help, or type xcopy /? at the command line.

To deploy or update individual files in an ASP.NET Web site from the command line

  1. Open a Windows command prompt.

  2. 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 file that you want to copy, and <destination path> is the full path to the directory where the copied file will be placed.

    The following example command copies a single DLL from a \Bin directory on one drive to a \Bin directory on another drive.

    Xcopy c:\inetpub\wwwroot\devapp\bin\sampleAssembly.dll d:\publicsites\liveapp\bin
    

    The following example command copies all of the DLL files from a \Bin directory on one drive to a \Bin directory on another drive.

    Xcopy c:\inetpub\wwwroot\devapp\bin\*.dll d:\publicsites\liveapp\bin
    
  3. The command might pause for you to answer a question such as "Overwrite filename (Yes/No/All)?" for which you can type your answer.

See Also

Concepts

ASP.NET Web Site Project Deployment Overview

Other Resources

Deployment for Web Site Projects