September 7

Visual Studio 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.



You may also like

  • {"email":"Email address invalid","url":"Website address invalid","required":"Required field missing"}

    Subscribe to our newsletter now!

    Get instant access to the Master C# 9 webinar to learn all the new exciting C# 9 features quickly.
    Get regular videos and news on C# and .NET and offers on products and services to master C#.

    We will collect, use and protect your data in accordance with our Privacy Policy.