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.
Permanent link to this article: https://www.productivecsharp.com/2012/09/visual-studio-tip-add-existing-item-as-link/