Reputation: 12117
We are using Git for source control and Visual Studio for development. Also, we have a common lib that is used in several projects.
Right now we manually copy the project files for that lib in every project and updates to the code, in the context of one project, force us to update the files manually in the other projects.
I would like to setup something like this:
Project1
Common Lib
Project files
Project2
Common Lib
Project files
I can see it done in two ways:
Where "Common Lib" would be its own git repository as a folder inside another repository.
Where "Common Lib" would be its own repository and having Visual Studio import it as an "external project" that does not belong to the solution's folder.
Which one would be doable and most practical?
Upvotes: 0
Views: 256
Reputation: 7301
I think in your case the Common Lib evolves as Project1 and Project2 evolves. Then a repository with submodules would suit you. Create a separate git-repository with Common Lib as project. Then add this repository as submodule to Project1 and Project2. Then, during development process you can easily change the code of Common Lib and commit it.
Another solution is to create a nuget-package from Common Lib. This is in my opinion a bit cumbersome if you have frequent changes in Common Lib. The reason is that you have to frequently publish new version of this nuget-package, either manually or by script.
Upvotes: 1
Reputation: 31177
The good practice in such case is to generate a nuget package and use it in your 2 projects.
Upvotes: 0