维护多个项目共有的 .NET 程序集引用
我和我的同事很长一段时间以来一直想知道执行此操作的最佳方法:维护多个项目中引用的 .NET 程序集的好/标准方法是什么?我将详细说明一下:
假设您有项目 A、B 和 C。它们可以位于相同的解决方案中,也可以位于不同的解决方案中,这并不重要。您还有项目 D 和 E 输出 DLL 供 A/B/C 参考。为了更好地衡量,我们将添加一个第三方程序集 F,为此我们只有裸露的 DLL。哪里是放置 D 和 E 中的程序集以及 F 中的文件的好地方,以便尽可能多地发生以下情况:
- 对 D 和/或 E 的更新不必手动刷新/更改项目 A、B 或 C;
- 项目 A、B 和 C 可以通过源代码控制下载到新机器上,并以最少的麻烦进行编译; D 和 E 的 DLL 输出以及
- F 的文件或多或少位于中心位置。
我可能问得太多了,但是有没有已知的方法可以完成大部分/所有这些?这件事让我们困惑了好一阵子。
My colleagues and I have been wondering the best way to do this for quite some time: what's a good/standard way to maintain .NET assemblies that are referenced in multiple projects? I'll elaborate a little bit:
Say you have projects A, B, and C. They could be in the same solution or different solutions, doesn't really matter. You also have projects D and E that output DLLs for A/B/C to reference. For good measure we'll toss in a third-party assembly F, for which we only have the bare DLL. Where is a good place to put the assemblies from D and E, plus the file from F, so that as many as possible of the following things occur:
- Updates to D and/or E don't have to be manually refreshed/changed in projects A, B, or C;
- The projects A, B, and C can be downloaded to a new machine via source control and compile with the least amount of hassle; and
- The DLL outputs for D and E as well as the file for F are more or less centrally located.
I'm probably asking too much, but is there any known way to accomplish most/all of this? It's been puzzling us for quite some time over here.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我认为以下方法应该可以解决问题:
1)有一个发布文件夹,其中包含您的第三方 dll。
2) 还添加一个构建后脚本,以在成功构建时将程序集 D.dll 和 E.dll 复制到发布文件夹中。
3) 项目 A、B 和 C 将引用发布文件夹中的 D.dll 和 E.dll。
此外,将发布文件夹中的 D.dll 和 E.dll 添加到源代码管理中也是没有意义的。构建机制应该能够自动处理这个问题。
The following should do the trick I think:
1) Have a release folder where your third party dll would be present.
2) Also add a post build script to copy assemblies D.dll and E.dll into the release folder on successful build.
3) The projects A, B, and C would reference D.dll and E.dll from the release folders.
Also it would not make sense to add D.dll and E.dll from the release folder into source control. Build mechanism should be automatically capable of handling this.
一种(可能不是最佳)解决方案是使用 Maven依赖管理。
请参阅本教程: 使用 Maven 管理 .NET 项目
One (probably not optimal) solution is to use Maven for your dependency management.
See this tutorial: Using Maven to manage .NET projects