Saturday 8 September 2012

Visual Studio Tip - Add Existing Item As Link

When you add an existing item in a project, Visual Studio automatically create a new copy of the file. This is usually what you want but sometimes you simply want to add a file as a link in order to reuse it and avoid to manage and maintain two different copies.

The trick is to use an "hidden" drop down menu in the "Add Existing Item" dialog.



You can see the effect because file added as link contains a special symbol (arrow) in the bottom left.


If you define macro in one of the project this technique allow you to share a file and customise it a little bit without the need to maintain two completely separate files. This is surely not a best practice but could be useful in some situations.

Visual Studio is clever enough to show you the code in grey based on where you open the file.




1 comment:

What you think about this post? I really appreciate your constructive feedback (positive and negative) and I am looking forward to start a discussion with you on this topic.