How to structure dependent projects on github?
Asked Answered
N

2

7

I recently put some of my projects on github to make them open source but I'm having trouble understanding how to structure the projects properly.

I've got a Core project and another project that depends on the Core project (plus more to come). However, when users grab a copy of one of the projects they complain that it's missing the Core project and I have to tell them that it lives in a separate repository.

I know there must be a better way to do this. I've read about git submodules but I don't really understand them yet.

My question is, are there any easy to follow tutorials or examples of how I can structure my projects? I'm using Windows, TortoiseGit and my projects are in C#.

Nerland answered 18/6, 2013 at 4:40 Comment(1)
A related answer regarding submodules hereInduration
H
1

You can use subtrees or submodules. http://blogs.atlassian.com/2013/05/alternatives-to-git-submodule-git-subtree/

Hartal answered 18/6, 2013 at 8:13 Comment(1)
If this is the best answer I'm going to get I'll approve it, but it's not really what I was looking for. What I'd really like to be able to do is right click a folder in windows and use TortoiseGit to get my repository with all dependencies. No fluffing around on the command line or anything like that. I realize this might not be in the spirit of git, but it's what I want and anything else is a compromise.Nerland
I
1

Instead of providing the source code for your dependencies, it may be better to use dependency management instead. This allows your projects to be built individually and also provides proper dependency versioning. This also means that your users do not need to worry about dependencies.

Microsoft's package manager for .NET - NuGet - is integrated into every version of Visual Studio nowadays. You can also try Paket as an alternative.


To package your project, you'd first add a package spec to your project. You then build a .nupkg file and upload it to NuGet.org to make it available to other projects. Check Microsoft's documentation for details.

In your main project, remove your dependency and use "Manage NuGet Package..." to add your own package as a dependency instead.

Ionization answered 28/7, 2018 at 9:12 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.