Let’s say you have two .Net applications: A and B and a shared component C. From a source code versioning point of view you could have:
- RepoFor(A, B, C)
- RepoFor(A, B) and OtherRepoFor(C)
- RepoFor(A, C) and OtherRepoFor(B)
- RepoFor(B, C) and OtherRepoFor(C)
- RepoFor(A) and RepoFor(B) and RepoFor(C)
Except for scenario (1), all the other scenarios would require to clone more than repo, and at the same you could have additional issues when dependencies AC and BC are established at source code level.
The «elegant way» of solving this situations is to establish the dependency at binary level, that is: A and B should depend on C.dll not on C source code. So to do that you need NuGet.
NuGet is a package manager for .Net that will allow to publish packages containing .dlls (and some other stuff too).
The following diagram illustrates the suggested solution:
Here are 2 short videos I recorded to show how to create and publish NuGet packages.