Paul Good
Paul Good

Reputation: 31

Shared Libraries/Shared Projects in Visual Studio. What is the best way to implement in GitLab?

I have considered using GitLab shared modules (one for each library) but that doesn't work because Visual Studio doesn't generate an assembly for each shared module.

If I create a separate repository for each shared project/library and include each project in the application solution then branching becomes a nightmare to manage.
It works but there must be a better way.

I have a .NET application in a Visual Studio solution which is a GitLab repository in itself. Also in that solution are three shared .NET library projects and each of them is a GitLab repository and each shared library project should create its own assembly. These shared library projects can be used by other .NET applications.

As I understand Visual Studio 2022 doesn't properly support multiple repositories in a solution.

So with that, if I want to branch the solution and its contents I have to branch 4 times: Once for the application and three times for the shared libraries. Which I think is error prone when switching between branches.

What would be nice is to branch once for the whole solution even though there are 4 repositories in a single solution.

Upvotes: 2

Views: 489

Answers (1)

VonC
VonC

Reputation: 1326776

in Gitlab?

It seems to me the issue would be the same in GitHub/BitBucket/Gitea/...

What would be nice is to branch once for the whole solution even though there are 4 repositories in a single solution.

That seems to suggest the use of a monorepo.

Note that Visual Studio 2022 is supposed to support multi-repo, but it is not quite there yet.

Amend, Stash, Branch switching & Network operations

Multi-repo support for Amend, Stash, Branch switching and network operations including Pull, Push, Fetch and Sync is coming to the Git Changes window in future iterations.

https://devblogs.microsoft.com/visualstudio/wp-content/uploads/sites/4/2021/08/MultiRepo-GitRepo.png

Upvotes: 1

Related Questions