Adding or linking existing files to a project in Visual Studio .NET


When you add a file to a project, you can either save the file to the project's folder, or you can link the file to the project. This article describes these options.

More Information

When you add an existing file to a project, the default option is to copy the file to the folder where your current project resides. If you want to instead link to the file (rather than actually moving the file to that folder) you can do so.

There is an important difference between these two options. If the file in question is shared between several projects and you want any changes that you make from any project to be reflected in the file, then you should link the file. If not, then you should copy the file so that each project has its own distinct copy. These options can be used in combination, but you should be careful to keep track of which project files are linked and which have been copied.

How to Specify the File Add Option

When you add an existing item to a project, you will be presented with the standard Open file dialog box. Look carefully at the Open button on this dialog box. You will see a drop-down arrow on the right edge of the button. Clicking on the arrow will display a list of three options:
  1. Open
  2. Open with
  3. Link file
Open is the default and will cause a copy of the existing file to be placed in your current project directory.

Open with allows you to specify an alternative program to open the file with.

Link file leaves the file in its current location and maintains a link to the file from your current project.

Article ID: 306234 - Last Review: May 13, 2008 - Revision: 1