Udostępnij za pośrednictwem


How to: Copy Items

The procedure for copying items in Solution Explorer is straightforward. However, the outcome when copying items varies by project type. Some projects, such as Web applications, require an actual file to exist in the project directory for each item shown in Solution Explorer. Others require that the item in Solution Explorer act as a link without requiring the file to reside in the project's directory. Some projects incorporate both links and files. The project type determines whether you are copying the file to the target location or copying a link to the file that remains in the original location. In all cases, Solution Explorer provides the appropriate item for the target project.

To copy items in Solution Explorer

  1. In Solution Explorer, select the item you want to copy.

  2. On the Edit menu, select Copy.

  3. In Solution Explorer, select the destination folder.

  4. On the Edit menu, select Paste.

If you are working with solution items, Visual C++ projects, or other similar projects, you are always working with links in Solution Explorer. If you are working with Visual Basic projects, Visual C# projects, and other projects, you might be working with links or files. Items that are links can be removed from the project without affecting the file in storage.

When you want to make sure that a link works on its own copy of an existing file, you might want to create a separate copy and add it to your project.

To create copies of items in Window Explorer

  1. In Windows Explorer, locate the file you want to copy, and then select Copy on the Edit menu.

  2. Locate the target project directory and then select Paste on the Edit menu.

  3. In Visual Studio, select the target project in Solution Explorer.

  4. On the Project menu, select Add Existing Item.

  5. In the Add Existing Item dialog box, locate the copy of the file you just made.

  6. Select Open.

When you work on the project item, you are working on a separate copy, not the original.

See Also

Concepts

Using Solution Explorer

Item Management in Projects

Reference

Solution Explorer