在.NET解决方案之间共享通用库的最佳实践 [英] Best practice to share common libraries between solutions in .NET

查看:50
本文介绍了在.NET解决方案之间共享通用库的最佳实践的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们拥有MSVS解决方案池(解决方案"A","B","C",...),它们共享名为"Common.dll"的程序集中的基本功能.

We have pool of MSVS solutions (Solution "A", "B", "C", ... ) that share basic functionality in assembly called "Common.dll".

有3-5种主动解决方案(正在开发中),而其他主动解决方案则是被动的,几乎无法重建.

There are 3-5 active solutions (that are under developing) while others are passive and hardly ever be rebuilt.

Common.dll始终在开发中.有几种方法可以保留我的解决方案代码,您将提出什么建议以及为什么?

Common.dll is always under developing. There are several options how to keep my solutions code, what will you suggest and why?

A).将common.dll源代码放入每个解决方案.优点:它可以帮助主动解决方案与common.dll并排发展,而被动解决方案则可以编译.缺点:很难在活动解决方案之间同步活动的common.dll代码

A). Put common.dll source code to every solution. Pros: it will help active solutions to grow with common.dll side-by-side while passive solutions will be compilable. Cons: it's hard to synchronize active common.dll code between active solutions

B).将common.dll二进制代码放入每个解决方案.优点:所有项目都是可编译的,而common.dll代码将被集中化.缺点:很难与common.dll并发地开发出有效的解决方案

B). Put common.dll binary code to every solution. Pros: all projects will be compilable while common.dll code will be centralized. Cons: it's hard to grow active solutions side-by-side with common.dll

C).将每个项目都引用到最后一个common.dll二进制文件,就像B.但是,如果common.dll会增长并更改其接口,它将给被动解决方案带来问题(有些人可能会说接口应该始终保持不变)

C). Reference every project to last common.dll binaries looks like B. but it'll bring problems with passive solutions if common.dll will grow and change it's interfaces (some may say interfaces should always stay constant)

D).?

先谢谢您!

推荐答案

我们练习的内容大多类似于B.

We practice something mostly like B.

CI服务器确保公共库始终是最新的(即使它们自己使用其他公共库).每个使用通用库的解决方案都有一个"Lib"文件夹,我们在其中放置了构建工件,但这些源不在源代码控制之下(与外部工件相反,例如通过NuGet导入的工件).

A CI server makes sure that the common libraries are always up-to-date (even if they use other common libraries themselfes). Each solution which uses common libraries has a "Lib" folder where we put the build artefacts, but these are not under source control (in contrast to external artefacts, such as the ones imported though NuGet).

因此,在开发过程中,您不会因为破坏公共库中的更改而遇到问题,并且开发人员选择了升级的时间点(但在提交中央存储库之前,他总是必须这样做).

So while developing you don't get problems because of breaking changes in the common libs and the developer chooses the point in time when he upgrades (but he always has to do that before he commits to the central repo).

CI服务器将始终将最新的公共库复制到正在构建的解决方案的库"中,以便集成最新的公共库.如果我们需要使用旧库(特定的修补程序版本-非常罕见)来创建版本,则始终可以使用匹配日期的版本工件.普通的修补程序/修补程序版本通常也可以升级到最新的公共库.

The CI server will always copy the latest common libraries into the "Lib" of the solution under build, so that the latest common libraries are integrated. If we need to create a build with old libraries (specific hotfix release - very rare), we can always use the build artefacts with the matching date. Normal patch/fix releases are usually also upgraded to the latest common libraries though.

这篇关于在.NET解决方案之间共享通用库的最佳实践的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆