Join two projects into one

Asked

Viewed 495 times

-1

I have two projects in Visual Studio, Project 1 has some things that Project 2 doesn’t have, and Project 2 has some things that Project 1 doesn’t have.

So I need to merge the two and turn it into just 1.

Can someone give me a hint the easiest way I can do this?

Note: I have the local repository of the two, and the two are also in Git, obviously separate.

Thank you in advance.

  • 1

    If both projects have the same files, a merge tool should help you. Like Winmerge or Kdiff3.

  • It would not be the case to commit the local versions in the source repository?

  • I used Winmerge and solved here, some things were manual even, but Winmerge saved me a good time. Thank you all

3 answers

1

There is no automatic way to do this, because the result only depends on what you want and a tool wouldn’t know how to make that choice.

A merge is the return of a code change when you have a branch, i.e., you initially made a copy of the code. In this case you don’t have a branch, the projects are different, and you want to unite them for any convenience, for example, architecture.

Then, manually, you will choose and move the necessary files. This if your projects are complementary.

Already in case they have been projects "mirror", for some reason, or simply, you are now organizing and saw that some things can be better if you want to move a Function or class, the technique for this is Refactoring, or Code refactoring. This technique also applies in some way to the first case.

Refactoring is basically the process of you tidying up the code or improving it, and for that it is good that you have automated tests.

Tools that have actions like: move class to another namespace, or move class for another project, move Function of a class to another, ...:

To learn more about the subject, and other important interconnected, I recommend reading the books:

https://martinfowler.com/books/refactoring.html

0

As you are in Visual Studio, there is an easy and fast way to do this. Just follow the next step by step:

  1. Right click on solution
  2. Add
  3. Existing project

Any questions you can leave here :)

-1

Easier to create a solution containing the two projects. The chances of giving problem are smaller.

But other than that, you would have to go file to file copying, or use some application that merges to files that should be the same.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.