Tuesday, December 12, 2006

Link to Files in VS2005

David Kline posted about sharing code between multiple projects (where a common assembly is not appropriate):

I would prefer to not create a duplicate of this file as maintaining changes between the two copies can be time consuming and error prone. Fortunately, Visual Studio 2005 has a great feature to allow for file sharing between projects -- you can add an existing file as a link. Here's how:

1. In the project where you wish to add the file, right click the project name in the Solution Explorer
2. Select Add and then Existing Item...
3. In the Add Existing Item dialog, navigate to the desired file
4. Click the downward pointing arrow next to the Add button and select Add As Link.
Once added to a project, linked files are easy to identify by the small arrow in the lower-left corner of the file icon in the Solution Explorer.

No comments: