How do I create Visual Studio shortcut files - visual-studio

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?

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

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:
(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: What is the difference between a Shared Project and a Class Library in Visual Studio 2015?

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

Related

How to find usage of code when projects are NOT added into one solution under visual studio 2010

I have a ASP.NET project that consists of many C# libraries in addition to the web project. The problem (for some reason) is that all projects that make up the web application are NOT added into one solution within a same visual studio. Instead, most projects are separated within individual visual studio. All projects are stored in source control, and shared by other developers.
Thus, the question is that how to find usage of any code, like "Find Usage" via Resharper. Is there any tools or tricks that allows me to do that like Resharper's Find Usage.
Any advice?
It looks like you're in something of a bind. My suggestion would be to simply make your own source control branch, and in that branch, you can create a new SLN file, add all of the projects, replace their binary project references by project references and then call Find Usages. Then, if you need to do any changes on the basis of Find Usage info, simply merge those in without merging PROJ or SLN files.
If these library projects are referenced as DLL files rather than the project references the only way is to open all the one-project solutions and search there by 'text'. There are some tips/tricks, which could simplify navigation a bit.
P.S. The situation you described looks far from convenient. I agree with Dmitri - you might consider to discuss with your team to switch onto referencing projects rather than using binaries. Once you switch each developer will be able to create local either solutions with the projects involved, or maybe you will agree on new common source controlled solutions.

Cannot add reference to wix project Visual 2012

In every tutorial and HowTo site (like here) about WiX I read I should add reference to my other project, but when I select Add Reference I have nothing on Project list in Project tab. I try this on Visual Studio 2012, earlier with WiX 3.7 and now on 3.8.
If there is solution simply not using "Add Reference" function how can I build this other way? I'm a beginner so I don't really know how to use WiX without this feature, if I published my C# application in Publish Wizard I should add all produced files to Component Group with every file in <Component> tag?
It could be this simple...
In Visual Studio, Add Reference's Project tab only lists projects in the same solution. You just need to Add Project to the solution and go back to the Add Reference's dialog.
A solution is just a set of zero or more projects that can be built together. You can have a project in more than one solution. The only limitation is that if project B references project A (B is downstream of A), A should be in every solution that contains B. If the universe of projects is small, it is typical to have only one solution for them all. On the other hand, if one developer works only on upstream projects, that developer might find it easier to work with a solution that doesn't have downstream projects.
Setup projects tend to be downstream but note that they probably don't depend on library test projects.
[Stream is not the best technical term. The universe of connected projects is a directed acyclic graph.]

Visual Studio Directory Settings For Multiple Projects

I have a solution in Visual Studio 2010 which contains multiple projects. All of those projects share a common directory for header files and library files. When I go to Tools->Directories it tells me this approach is deprecated and that there is a separate Directory properties for each project. Surely Microsoft don't expect me to now add these settings to each project individually. Is there not a top level property which all projects inherit and then this project specific property? Am I missing something or do I really need to do this per project now?
What you want to use are called PropertySheets.
When used right they are very powerful, especially for large projects.
With these you can specify much more common things, than just only different directories.

Is there a way to have one project build another in Visual Studio?

We are finally getting a source control system in place at work and I've been in charge of setting it up. I've read that it's usually good practice to not include binaries in source control so I haven't. However, we have two all-purpose utility projects (each in their own solution) that generate utility .dll's which are included in almost all of our other projects (all each in their own separate solutions). We add references to the utility dll from our projects.
I would like to have our solutions set up in such a way that if the reference dll isn't built, the solution will build the dll for itself, much in the same way a make file checks for its dependencies and builds them when they're out of date or missing.
I'm new to build processes with VS so try to keep the answers simple. Any links to general build process overview tutorials would be great too. Googleing for VS references returns a bunch of how-to add references links which is not exactly what I want.
Answer: (3 step process) Add a project reference, not a binary reference by right clicking on the solution, and adding an existing project. Then under the project tab, select project dependencies and modify the project so that one project depends on another. Finally, delete any old reference to the binary and re-add the reference using the project tab in the Add references dialog box.
Where I work we typically have project references rather than binary references (as we used to a while ago). When you include a project reference, the dll will build along with the rest of your app.
The only time we go back to binary references is when we are in between Visual Studio releases (e.g. 1 project is in 2010 and everything else is in 2008. The 2010 project will have to use a binary reference for a couple of months until everyone else catches up... Project incompatibility seems to be a Visual Studio limitation that shouldn't exist).
EDIT
To add a project reference right click the solution and click Add and finally "Existing Project." Make sure that the utility projects are also under source control, and make sure that the workspaces are set up correctly or other people will not be able to open up the projects correctly!

Solution file vs. Project file in Visual Studio

Can someone briefly explain to me the difference between Visual Studio's solution file (.sln) and project file (.vcproj).
It seems to me opening either one open the correct solution/project in Visual Studio. Is one the super-set of the other?
Note: I am currently using Visual Studio 2008 working on a project that was brought forward from Visual Studio 2005 (I believe).
A solution is a set of projects. If you need more than one project in your software, then go with solutions. I.E.: A Class Library Project + A Web Application Project.
A project file typically corresponds to a single module: EXE or DLL or LIB. A solution manages a collection of project files.
A solution is a collection of projects. Visual Studio is made so that it cannot function without a solution, so if you open a bare project, it will generate the solution automatically (or try to find one).
One solution can contain zero or more projects. Everything is in projects, so a solution with zero projects doesn't contain anything at all besides the solution properties.
Visual studio keeps track of where the projects are used, so if you open a project file, it will open (IIRC) the last solution where it was used.
When you create a project from scratch, a solution is also created, but it's not shown until you add another project to it. It looks like you have only the project open, but it's actually a solution containing the project that is open.
Specifically project files are intended to contain the data required to build the files in the project into an exe or dll. This file is utilized by the local compilers or with systems such as Team Foundation system and server side build agents.
Solutions are a client (IDE) construct designed to manage collections of projects, which in effect is a collection of different build definitions and associated files.
Solution files are typically made up of multiple project files.

Resources