deebs
deebs

Reputation: 1410

.NET Added Existing Project but need to separate from original

I created a new solution in Visual Studio 2012, and wanted to use another solution's projects as a template. At the time I chose to use "Add Existing Project", then later realized that every time I update the project in one solution, it is updated in the other as well (as noted here). I'd like to leave the project, but undo the "link" it has. I tried changing the Source Control bindings but that did not fix the issue. As stated in the above article, "Every time that you update the new project, build your solution. This makes sure that updates to the new project are reflected on the artboard in the original project." - that is the part I'd like to undo, if possible.

Upvotes: 1

Views: 137

Answers (3)

Tummala Krishna Kishore
Tummala Krishna Kishore

Reputation: 8271

Solution can't explicitly depend on another solution , only the project's of one solution may depend on another project in another solution .

One solution is you can simply create a separate Class Library project to contain the common code. It may not be part of any solution that uses it. Reference the class library from any project that needs it.

Main part here is that you will need to add a file reference to reference the project, because it will not be part of the solutions that would refer to it. so the actual output assembly will have to be placed in a location that can be accessed by anyone building a project that references it. This can be done by placing the assembly on a share, for instance.

This is another solution assumes that you are using the Git as a Source Control Management.you can create a Separate Branch for the each solution that share the same code and when you build one branch it may not be linked to other branch until unless you explicitly specified it as your project dependency.

but then as each branch will have the separate location in file system but in source control you see them under same hood.

Upvotes: 1

Morcilla de Arroz
Morcilla de Arroz

Reputation: 2182

Maybe you have to create a third project, with all the business logic, and then, you can use two projects, independents among them, adapted to your needings, sharing only the real common code.

Upvotes: 0

jellomonkey
jellomonkey

Reputation: 1964

You will need to copy the projects to a different location and then re-add them from that location. The steps are:

  1. For each project in the solution make a copy to a new location.
  2. Remove all the projects from the current solution (or create a new empty one.)
  3. Add all of the newly copied projects into the solution.
  4. Re-create any references between projects.

WARNING: This means you will have two independent copies of these projects and changes to one set will never be reflected in the other. If this isn't what you are going for you may need to look into branching / forking a project.

Upvotes: 1

Related Questions