Freigeben über


Did you know… How to add a Linked Item to a project - #365

This feature is helpful when you need a common file shared among projects, like a bitmap, readme, set of common tools and utilities, etc.

To add, right-click on the project in the solution explorer, and select Add – Existing Item.   You’ll notice the “Add” button is one of those button-dropdowns.  Drop down the Add button and select Add a link

Add Existing Item with Add as Link selected

Now you have a linked item in your project as indicated by the shortcut icon.

Linked item in Solution Explorer

The location of the linked file is saved in the project file.  The location must be via the file system, either on different drives or UNC.  No http or ftp.

Technorati Tags: VS2005Tip,VS2008Tip

Comments

  • Anonymous
    November 26, 2008
    This doesn't seem to work for C++. I only get a basic Add button without the arrow. Am I doing something wrong?

  • Anonymous
    November 26, 2008
    So, if you add a link, this will only works when the path exists, if you give the source to anyone else, and path doesn't exist, linked item won't work. Am i right?

  • Anonymous
    November 26, 2008
    Great post.  Does this work with aspx pages or master pages?

  • Anonymous
    November 26, 2008
    This also makes for a great way to share asp user controls between web projects. http://ryanwe.blogspot.com/2008/10/sharing-user-controls-between-web.html

  • Anonymous
    November 26, 2008
    Saw ppl using this in videos, did not know exactly how, thanks, a very helpful tips

  • Anonymous
    November 27, 2008
    @Antony: It's true, on Visual C++ doesn't work, Add a link isn't available.

  • Anonymous
    December 02, 2008
    But why is this feature so hidden that it needs a special blog post?  :)  Hi Sara, long time, good to know you're still rockin.

  • Chris
  • Anonymous
    December 02, 2008
    We use this feature to link in common assembly attributes (like assembly version, product and company information etc). Very useful! Since I was not aware of the GUI way of doing this I did it by modifying the project file directly. Thanks for the tip, next time around I might do it the click-and-browse way.

  • Anonymous
    December 05, 2008
    Is this available for C# projects - the Add button doesn't have any selection?

  • Anonymous
    April 09, 2009
    本篇包括tip361-tip370http://www.watch-life.net/visual-studio/visual-studio-2008-tip-day-36.html#361、按...