44

I have two Visual Studio 2005 solutions, one of which builds a binary and all of its dependencies, and one of which builds a web app and some utilities and an installer for them. Up until now, we've had the aforementioned binary just included in the installer as a static file; I want to take all of the projects from that binary's solution and have them be part of the installer solution, for a single once-through build of everything.

As far as I can tell, I can't add the existing projects from the binary's solution without losing the dependency information. This will work, but since there are 20 some projects involved, I want to preserve dependency information when moving the projects in. It's looking like I may just have to do this in a text editor with the solution XML... is there a better way?

Note that this is NOT the same as the related questions about merging two versions of the same solution file.

UltraNurd
  • 1,314
  • 2
  • 14
  • 24
  • 1
    If your installer has only or two projects, you can consider adding these projects to the binary's solution. – dirkgently Mar 02 '09 at 20:20

4 Answers4

92

There's a way to do this built in to Visual Studio. Right click the solution, and select Add -> Existing Project. Select the other solution from there.

stuzor
  • 2,275
  • 1
  • 31
  • 45
Sander Rijken
  • 21,376
  • 3
  • 61
  • 85
  • 18
    Thanks, this is what I was looking for. I didn't think this would work, since it's called "Existing Project" and doesn't show Solution files, but you just need to change the "Files of type" field to "Solution files" from "All project files" – UltraNurd Mar 02 '09 at 23:12
  • Any workaround if the project to be added has the same name as the currently opened project? – Aditya Jan 18 '17 at 16:17
  • 1
    @Aditya, perhaps you can edit the .SLN file and globally replace each project name with a different (and unique) one, but you would have to rename the project files on disk to match. – Francis Litterio Oct 28 '19 at 19:51
  • 2
    For me, Solution Files wasn't in the file type filters. So instead I just had to type *.sln in the filename textbox, and then it showed the files for me. – stuzor Nov 16 '22 at 04:11
  • It was very wonderful. In addition of projects, solution folder structure also is imported for me. same as @stuzor I had to type *.sln in the filename textbox. – afruzan Jan 20 '23 at 18:01
3

If you want to automate the process you can try playing around with this tool

http://code.google.com/p/merge-solutions/

bushed
  • 1,050
  • 1
  • 15
  • 27
0

You might want to consider using references instead of the dependencies. Those are stored in project's file and consequently are preserved across solutions. There might be something which can be done with Dependencies and not with References, however I am not aware of any such situation and for simple uses references are more than enough.

EFraim
  • 12,811
  • 4
  • 46
  • 62
-2

Try selecting all of the project nodes in the tree then drag & drop them into the other solution.

flodin
  • 5,215
  • 4
  • 26
  • 39