Reputation: 83
I am new to versioning, and have implemented a GitLab group and a project within it on gitlab.com.
I have several apps developed in Visual Studio - the solutions use projects that reside in separate folders on my computer.
For instance:
I implemented version control for one of the DLLs, but when I try to do the same e.g. for application X from inside MSVS I get an error message because the different projects that make up the solution (in this case A and X) are in different folders.
Is this a limitation, or is there a way to have two repos for a solution, one of which dealing with the versioning of DLL A, and one with the remainder of the executable code for X.
When I open the X solution, I see all the A versioning in the team window, but have not tried to add a git repository for the code that builds the app, i.e. X in the description above.
Upvotes: 1
Views: 1938
Reputation: 1326782
For multiple projects, see if GitLab 13.8 (January 2021) can help.
Install NuGet packages from your group or subgroup
You can use your project’s Package Registry to publish and install NuGet packages. You simply add your project as a source using the NuGet CLI, Visual Studio, or the .NET CLI.
For example, using the NuGet CLI you can run:
nuget source Add -Name <source_name> \ -Source "https://gitlab.example.com/api/v4/projects/<your_project_id>/packages/nuget/index.json" \ -UserName <gitlab_username or deploy_token_username> \ -Password <gitlab_personal_access_token or deploy_token>
This works great if you have a small number of projects.
But if you have multiple projects nested within a group, you might quickly find yourself adding dozens or even hundreds of different sources.
For large organizations with many teams, it’s common for a team to publish packages to their project’s Package Registry alongside the source code and pipelines.
But, they also need to be able to easily install dependencies from other projects within their organization.Moving forward, you can install packages from your group so you don’t have to remember which package lives in which project.
Simply add your group as a source for NuGet packages and you can install any of the group’s packages.
nuget source Add -Name <source_name> \ -Source "https://gitlab.example.com/api/v4/projects/<your_group_id>/packages/nuget/index.json" \ -UserName <gitlab_username or deploy_token_username> \ -Password <gitlab_personal_access_token or deploy_token>
We hope this feature makes sharing dependencies between projects a little bit easier.
See Documentation and Issue.
Upvotes: 0
Reputation: 44
The Visual Studio Git or “Team” functionality only handles a single repository.
There is a feature request in state “On Roadmap” for this feature, so they plan to implement it.
You can still use Visual Studio to switch between individual repositories and handle them then, or you can use a third party tool to handle Git versioning. For example TortoiseGit, which you can use in Windows Explorer from the right click context menu.
Disregarding Visual Studios limitation you have quite a few options how you want to handle dependencies and their versioning.
If they are distinct components you could make them produce NuGet packages, and add those as dependencies.
If you want to edit them in one workspace and repository checkout at once (without the indirection of a separate VS instance and having to build the NuGet package separately), then you will probably want to use git submodules - to make one reference and check out another in a subfolder.
Submodules make it a little bit harder and less simple to manage code, because you will have a repository in a repository. And having some technical knowledge about them certainly helps when working with them.
Upvotes: 1