Link Files Between Different Projects - Visual Studio

You can add file to an existing project either by copying the files directly or create a link between them. When you create a link, the file does not get physically copied to a new location, only a reference is set to it. The process is quite simple as shown here.

Right click your project in Solution Explorer > Add > Existing Item. Browse to the file you want to add and click the small ‘drop-down’ arrow as shown below

image

Choose the ‘Add as Link’ option and the file will get added as a link, rather than directly adding the file to your project. Linked project items in Solution Explorer can be identified by the link indicator in its icon, as shown below.

image

Note: If the original file is deleted, the link gets broken. You also need to manually update a copy whenever changes are made to the original file.

No comments:

Post a Comment