How to: Deploy a Web Site Project by using the Copy Web Site Tool

This topic describes how to copy files from a local Web site to a remote Web site using the Copy Web Site tool in Visual Studio.

You can use the Copy Web Site tool in Visual Studio to copy files from a local site to a remote site or vice versa. You can copy selected files individually or copy all of the files for a site at once. Additionally, you can synchronize two sites, which copies files as required to be sure that both sites have identical copies of all files.

The remote site is any site that you want to copy files to or from. The remote site might actually be remote (on another server), or it might be a different site on your local computer.

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.

You must have sufficient permissions to be able to read, write, create, and delete files on the remote site. If you are unsure, check with the administrator for the remote site.

Before you deploy or redeploy a Web project, you might want to prevent the production site from responding to page requests during the deployment process. This can help avoid errors that might result during the time when changes are only partially completed. Also, you might want to make sure that the application domain does not recycle multiple times during deployment. For more information, see How to: Prepare to Deploy a Web Project.

Opening the Copy Web Site Tool

Before performing any of the following procedures, you must open the Copy Web Site tool.

To open the Copy Web Site tool

  • On the Website menu, click Copy Web Site.

    The Copy Web window is displayed with files from the currently open Web site in the Source Web site list.

Connecting to a Remote Site

The Copy Web Site tool copies files between the site listed as Source Web site and the site listed as Remote Web site. The source site is the Visual Studio project that you have open. The remote site is the site you want to copy to or from.

To connect to a remote site

  • From the Connections list, select the site to connect to as the remote site. If the site that you want to connect to is not in the list, select Connect and then use the Open Web Site dialog box to connect to the site that you want to copy files to or from.

    When the Copy Web Site tool opens the remote site, it examines the files on both sites and indicates the status of each file. (For a list of statuses and what they mean, see the table at the end of this procedure.)

    To see files that have been deleted, select the Show Deleted Files check box. The names of deleted files have a glyph next to them indicating that they have been deleted.

After you connect to the remote site, each file will have one of the following statuses.

Status

Description

Unchanged

The file has not changed since the last time the file was copied.

Changed

The file has a timestamp that is newer than the timestamp taken when the file was last copied.

If the same file has been changed in both the source site and the remote site and you synchronize these files, the tool prompts you to indicate in which direction you want to copy.

New

The file has been added since the last time the site was copied.

Deleted

The file has been removed since the last time the site was copied. These files are shown only if you select Show Deleted Files.

If you synchronize a file that has been deleted in one site, the tool will prompt you to indicate if you want to delete the file from the other site.

Connection information is persisted in Visual Studio, although the connection is live only while you are working with a site. This means that the next time you select Copy Web Site, the same remote site will appear in the Remote Web site panel of the Copy Web window.

If you know that you will not need to connect to a particular remote site any more, you can remove the connection information.

To remove a connection

  1. From the Connect list, select the connection that you want to remove.

  2. Click Disconnect.

Copying or Synchronizing Files

The first time you deploy a Web site project, you typically want to copy all of the files in the project to the remote site. Subsequent times you might want to copy all files or selected files, or synchronize some or all of the files.

Note

The tool copies only the files that are included in the Web site project's folder and subfolders. If the project contains a reference to a component that is not in the project folder (for example, the component is registered in the global application cache (GAC)), the component will not be copied with the application. For information about the GAC, see Global Assembly Cache.

To copy or synchronize files

  1. If it is possible that files have changed in the source site or remote site since you opened the Copy Web Site tool, click Refresh Source Web Site or Refresh Remote Web Site.

  2. Select the files in the source site or the remote site that you want to synchronize or copy.

    You can navigate down the folder hierarchy to select files in subfolders the same way you would in Windows Explorer.

  3. Click the appropriate button to copy or synchronize the selected files:

    • The button that has the right arrow copies files from the source site to the remote site.

    • The button that has the left arrow copies files from the remote site to the source site.

    • The button that has both right and left arrows synchronizes the selected files.

    All selected files are copied or synchronized, overwriting existing files. In some cases (noted previously in the table of statuses) you might be prompted before the tool copies or deletes a file.

    Note

    An older version of a file is never copied over a newer version. Because of this, the two sites might not be identical even after the entire site is copied.

See Also

Tasks

Walkthrough: Deploying a Web Site Project by Using the Copy Web Site Tool

Other Resources

Deployment for Web Site Projects