visual-studio 将两个或多个 Visual Studio 项目合并为一个项目

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/3635330/
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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-22 12:25:40  来源:igfitidea点击:

Merging two or more visual studio project into a one project

.netvisual-studiovisual-studio-2010

提问by Coder

I am working on a solution that contains bunch of projects. I am going to refactor the solution by merging some of the projects together.

我正在研究一个包含大量项目的解决方案。我将通过合并一些项目来重构解决方案。

Is there any tool or visual studio extension that helps me refactor my large solution by merging one or more projects into on project.

是否有任何工具或 Visual Studio 扩展可以帮助我通过将一个或多个项目合并到项目中来重构我的大型解决方案。

Of course this can be done manually but I am hoping for a more automated solution!

当然,这可以手动完成,但我希望有一个更自动化的解决方案!

回答by Jura Gorohovsky

Try "Move to Folder" refactoringin ReSharper, it will deal with namespace and using directive changes that the merge implies.

在 ReSharper 中尝试“移动到文件夹”重构,它将处理命名空间并使用合并暗示的指令更改。

  1. In Solution Explorer, select files that you want to move from your source project to your target project.
  2. Choose ReSharper > Refactor > Move. Here's how the refactoring dialog looks like.
  3. Choose a destination project (or a folder in it).
  4. Make sure to keep "Fix namespaces" selected and apply the refactoring.
  1. 在解决方案资源管理器中,选择要从源项目移动到目标项目的文件。
  2. 选择 ReSharper > 重构 > 移动。下面是重构对话框的样子
  3. 选择目标项目(或其中的文件夹)。
  4. 确保选择“修复命名空间”并应用重构。

If there are conflicts that prevent the move, ReSharper will let you know about them. Otherwise, the refactoring will be applied immediately.

如果存在阻止移动的冲突,ReSharper 会通知您。否则,将立即应用重构。

P.S. I work at JetBrains

PS 我在 JetBrains 工作

回答by Richard

You can drag and drop items from one project to another.

您可以将项目从一个项目拖放到另一个项目。

Any namespace etc. changes you want will need to be done manually.

您想要的任何命名空间等更改都需要手动完成。

This will copythe files, and create as an add to any integrated VCS.

这将复制文件,并作为添加到任何集成的 VCS 创建。

Another approach is to branch in VCS into the destination project and then use "add existing item" to add. This will (depending on your VCS) maintain history.

另一种方法是在 VCS 中分支到目标项目中,然后使用“添加现有项目”进行添加。这将(取决于您的 VCS)保留历史记录。

回答by Prince Ashitaka

The far better way is to write a utility of your own with custom logics to update the .csproj or .vbproj files and moving the files to specific folder and re-naming the namespaces. That will saves lot of time.

更好的方法是使用自定义逻辑编写您自己的实用程序来更新 .csproj 或 .vbproj 文件并将文件移动到特定文件夹并重新命名命名空间。这样会节省很多时间。

But, there are few tools available. I don't how they are upto.

但是,可用的工具很少。我不知道他们怎么样了。

http://slntools.codeplex.com/
http://www.projectmerge.com/index.php

http://slntools.codeplex.com/
http://www.projectmerge.com/index.php

HTH

HTH