Thomas
Thomas

Reputation: 12117

How to share a library in multiple other projects with GIT or VisualStudio

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

Project2

I can see it done in two ways:

Which one would be doable and most practical?

Upvotes: 0

Views: 256

Answers (2)

Michael Mairegger
Michael Mairegger

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

Philippe
Philippe

Reputation: 31177

The good practice in such case is to generate a nuget package and use it in your 2 projects.

Upvotes: 0

Related Questions