How do I create Visual Studio shortcut files

Visual StudioShortcut

Visual Studio Problem Overview


In Visual Studio there is a way to have a file in another project that is a shortcut to the first so that it builds in both. How do I do that?

Visual Studio Solutions


Solution 1 - Visual Studio

Right-click the project, select Add > Existing Item, and in the dialog drop down the Add button and select Add As Link.

Add As Link

Solution 2 - Visual Studio

This is not a direct answer but an alternative that may be worth considering in some cases.

You can create a specific kind of project which can "include" a set of files in another project when it is added by reference. This is called a Shared Project which is one of the 'new project' options:

enter image description here

(Since at least Visual Studio 2015 - maybe earlier).

One advantage of this type of project over individual shortcuts is that it includes a set of things as a bundle. So if you have a large # of items, this may be easier and less error prone.

Also it uses the familiar "reference" metahphor in the context of the solution and in that way functions quite similarly to other project references; the difference is that in a shared project the items in the project are added into each referring project, but in a normal project the assemblies (DLLs) end up owning the reference at runtime. Shortcuts may be less familiar to other developers than the reference pattern.

More information: https://stackoverflow.com/questions/30634753/what-is-the-difference-between-a-shared-project-and-a-class-library-in-visual-st

Solution 3 - Visual Studio

Are you talking about a solution with multiple projects? In that case answer would be using Project Dependencies (within Project menu).

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionMatthew KruskampView Question on Stackoverflow
Solution 1 - Visual StudioitowlsonView Answer on Stackoverflow
Solution 2 - Visual StudioStayOnTargetView Answer on Stackoverflow
Solution 3 - Visual StudioSzere DyeriView Answer on Stackoverflow