visual-studio 如何合并两个不同的 Visual Studio 解决方案?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 
原文地址: http://stackoverflow.com/questions/603744/
Warning: these are provided under cc-by-sa 4.0 license.  You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How do I merge two different Visual Studio solutions?
提问by UltraNurd
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.
我有两个 Visual Studio 2005 解决方案,其中一个构建二进制文件及其所有依赖项,另一个构建 Web 应用程序和一些实用程序以及它们的安装程序。到目前为止,我们已经将上述二进制文件作为静态文件包含在安装程序中;我想从该二进制文件的解决方案中获取所有项目,并将它们作为安装程序解决方案的一部分,以便对所有内容进行一次一次性构建。
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?
据我所知,我无法在不丢失依赖信息的情况下从二进制解决方案中添加现有项目。这会起作用,但由于涉及 20 个项目,我想在移动项目时保留依赖信息。看起来我可能只需要在文本编辑器中使用解决方案 XML 执行此操作...有没有更好的大大地?
Note that this is NOT the same as the related questions about merging two versions of the same solution file.
请注意,这与有关合并同一解决方案文件的两个版本的相关问题不同。
回答by Sander Rijken
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.
有一种内置于 Visual Studio 的方法可以做到这一点。右键单击解决方案,然后选择添加 - 现有项目。从那里选择其他解决方案。
回答by bushed
If you want to automate the process you can try playing around with this tool
如果你想自动化这个过程,你可以尝试使用这个工具
回答by EFraim
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.
您可能需要考虑使用引用而不是依赖项。这些存储在项目的文件中,因此可以跨解决方案保留。可能有一些事情可以用依赖关系而不是引用来完成,但是我不知道任何这种情况,对于简单的使用,引用已经绰绰有余了。
回答by flodin
Try selecting all of the project nodes in the tree then drag & drop them into the other solution.
尝试选择树中的所有项目节点,然后将它们拖放到另一个解决方案中。

