Partilhar via


Copying Web Sites with the Copy Web Site Tool

The Copy Web Site tool allows you to copy files between the current Web site and another site. You can run the tool by selecting Copy Web Site from the Website menu.

The Copy Web Site tool is similar to an FTP utility, but differs in the following ways:

  • It allows you to connect to and copy files between any type of Web sites you can create in Visual Studio, including local Web sites, IIS Web sites, remote (FrontPage) Web sites, and FTP sites.

  • It supports a synchronization feature, which examines the files on both sites and makes sure that all of the files are up to date.

You can use the Copy Web Site tool to move files from your local computer to a staging server or to a production server. The Copy Web Site tool is especially useful in situations where you cannot open files from the remote site to edit them. You can use the Copy Web Site tool to copy the files to your local computer, edit them, and then copy them back to the remote site. You can also use the tool to copy files from a staging server to the production server when you have finished your development.

Note

If you copy an application that contains a reference to a custom component that is registered in the GAC, the component will not be copied with the application. For more information, see How to: Add a Reference to a .NET or COM Component in a Web Site.

Source and Remote Sites

The Copy Web Site tool copies files between a source site and a remote site. These terms are used distinguish the two sites that the tool is working with. The terms are used with specific meanings:

  • Source site   The source site is the site that you currently have open in Visual Studio.

  • Remote site   The remote site is the site to which you want to copy files. A remote site can be a location on another computer that you can access using FrontPage Server Extensions or FTP. In these cases, the site is literally remote. However, the remote site can also be another site on your own computer. For example, you can publish from a file-system Web site on your computer to a local IIS Web site that is also on your computer. In this case, although the site is local to your computer, it is the remote site for purposes of the Copy Web Site tool.

Note that the source site is not necessarily the source for copying. You can copy from the remote site to the source site.

Synchronizing Sites

In addition to copying files, the Copy Web Site tool allows you to synchronize sites. Synchronizing examines the files on the local and remote sites and makes sure that all files on both sites are up to date. For example, if a file on the remote site is more current than the version of the same file on the local site, synchronizing the files copies the file on the remote site to your local site.

Note

The Copy Web Site tool does not merge files that have the same name but different content. In that case, synchronization gives you the opportunity to specify which version of a file you want to keep.

Synchronization makes the tool well suited to a multi-developer environment where developers keep copies of the Web site on their local computers. Individual developers can copy their latest changes to a shared remote server and at the same time update their local computer with changed files from other developers. A new developer on a project can also quickly get copies of all the files for a Web site by creating a local Web site on his or her own computer and then synchronizing with the site on the shared server.

File Status

To synchronize files, the Copy Web Site tool needs information about the state of the files on both sites. Therefore, the tool maintains information consisting of the files' timestamps plus additional information required to perform synchronization. For example, the tool maintains a list of when the files were last checked, which enables the tool to determine information such as whether a file has been deleted.

When you connect to a site (or refresh), the tool compares the timestamps of the files on both sites and the information it has stored for both sites and reports the state of each file. The following table shows the status of the files.

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.

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. If you select Show Deleted Files in the Copy Web Site tool, an entry for the file is displayed in the window.

See Also

Tasks

How to: Copy Web Site Files with the Copy Web Site Tool