我应该如何管理/声明开源 C# 项目之间的依赖关系?

发布于 2024-09-04 06:19:29 字数 638 浏览 2 评论 0原文

我有一个 C# 游戏(具体来说是 Roguelike),我正在将其清理为开源。我想要采取的一个步骤是将其分成三个不同的部分:

  1. 一个简单的实用程序类包,诸如 2D 数组、向量等。
  2. 一个终端 UI 包,可为您提供类似诅咒的显示。这取决于 1.
  3. 实际的游戏,它使用 1 和 2。

现在,这些都是同一解决方案中的独立项目,但我想让它们完全独立的项目(在“开源项目”意义上) ,而不是“视觉工作室项目”使用该术语)具有自己的名称和存储库。我认为,至少,即使您不构建游戏,#1 通常也是有用的,而且我不希望有人仅仅为了获得一些方便的功能而必须构建整个游戏。

我不确定的是,如果我拆分解决方案,如何处理依赖关系。如果有人决定要同步游戏,我应该如何确保他们也获得 1 和 2?

  1. 将构建的依赖 .dll 包含在游戏存储库中?
  2. 只需记录,“您需要这些其他项目,并且它们必须位于与游戏相关的路径中,如下所示”。
  3. 只需将其全部保留为一个庞大的解决方案和一个存储库即可。
  4. 有什么我没有想到的吗?

I've got a game (a roguelike to be specific) in C# that I'm in the process of cleaning up to open source. One step I'd like to take is splitting it into three distinct pieces:

  1. A simple package of utility classes, things like 2D arrays, vectors, etc.
  2. A terminal UI package that gives you a curses-like display. It depends on 1.
  3. The actual game, which uses 1 and 2.

Right now, these are all separate projects in the same solution, but I'd kind of like to make them completely separate projects (in the "open source project" sense, not the "visual studio project" use of the term) with their own names and repos. I think, at the very least, #1 is generally useful even if you aren't building game, and I don't want someone to have to build an entire game just to get some handy functions.

What I'm not sure about is how to handle the dependencies if I split up the solution. If someone decides they want to sync the game, how should I ensure they also get 1 and 2?

  1. Include the built dependent .dlls in the games repo?
  2. Just document, "you need these other projects and they must be in a path relative to the game like this".
  3. Just leave it all one giant solution and a single repo.
  4. Something I'm not thinking of?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

一江春梦 2024-09-11 06:19:29

我会选择你的选项1。如果我作为一个用户想要处理游戏项目,我不关心其他两个项目,但游戏需要它,所以包含dll。

如果我想更改实用程序类,那么我可以更改实用程序项目。

就像我在自己的项目中使用了别人的开源项目一样。当对方的库需要更改时,我会去那里进行修改,然后获取该项目的最新 .dll 作为依赖项。

I would go with your option 1. If I as a user want to work on the game project, I do not care about the other two projects, but the game needs it, so include the dll.

If I want to make changes to the utility classes, well I then make changes to the utility project.

It is like me using another party's open source project in my own. When the other party's lib needs changes I go and make it there and then just get the latest .dll for this project as a dependency.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文