I have several C# projects, each in its own git repository. All these projects use one shared project which is also in its separate git repository. Now I want to add the shared project as a submodule to the main project.
My first idea was to make a special directory for submodules which represents these submodules are dependencies of the main project:
main repo root
+ lib
| + submodule1 repo
| | ...
| | + submodule1.shproj
+ src
...
main.csproj
Unfortunately when I do this, Visual Studio tries to build each file of the submodule twice because the file is included in the submodule, but also in the main project (since it is placed in a subdirectory of the main project). The only solution is to exclude the lib dir from the main project, which is a little bit disturbing this nice concept... This leads me to the second directory layout idea:
main repo root
+ main_project
| ...
| + main.csproj
+ submodule1
| ...
| + submodule1.shproj
+ main.sln
This would probably work, but when I open such repository, it is not clear, which project is the main and which project is only a dependency :(
What directory structure do you prefer when working with shared projects? Is there a best-practice on this topic?