简体   繁体   English

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

[英]How should I manage/declare dependencies between open source C# projects?

I've got a game (a roguelike to be specific) in C# that I'm in the process of cleaning up to open source. 我在C#中有一个游戏(roguelike具体),我正在清理开源。 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. 一个简单的实用类包 ,比如2D数组,向量等。
  2. A terminal UI package that gives you a curses-like display. 终端UI包,为您提供类似curses的显示。 It depends on 1. 这取决于1。
  3. The actual game, which uses 1 and 2. 实际游戏,使用1和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. 我认为,至少#1通常很有用,即使你没有建立游戏,我也不希望有人为了获得一些方便的功能而必须建立整个游戏。

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和2?

  1. Include the built dependent .dlls in the games repo? 在游戏仓库中包含已构建的依赖.dll?
  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? 我没想到的东西?

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. 我会选择1.如果我作为用户想要参与游戏项目,我不关心其他两个项目,但游戏需要它,所以包括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. 当对方的lib需要更改时,我会去那里然后只是获取该项目的最新.dll作为依赖项。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何获得我的 C# 项目之间的依赖关系图 - How do I get a diagram of the dependencies between my C# projects 正确组织C#中项目之间的依赖关系 - Right organization of dependencies between projects in C# 如何在Unity项目之间共享c#源代码? - How to share c# source between Unity projects? C#:如何管理项目中的符号常量? 你在哪里声明解决方案范围常量? - C#: How do you manage symbolic constants in your projects? Where do you declare solution scope constants? 考虑到它们之间的依赖关系,我应该如何将我的项目发布为 NuGet 包? - How should I publish my projects as NuGet packages considering dependencies between them? 如何使用开源依赖项组织开源Visual Studio项目? - How do you organise open-source Visual Studio projects with open-source dependencies? 如何在Visual C#项目之间同步版本? - How do I sync versions between Visual C# projects? 开源C#代理服务器 - 任何项目/示例? - open source C# proxy server - any projects/examples? 生成C#项目及其依赖项 - Build C# Projects and their dependencies 如何管理C和C之间的缓冲区# - How to manage a buffer between C and C#
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM