使用通用/实用程序库 [英] Working with Common/Utility Libraries

查看:26
本文介绍了使用通用/实用程序库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我工作的公司,我们有一个Utility"项目,我们构建的几乎所有应用程序都引用了该项目.它有很多东西,比如 NullHelpers、ConfigSettingHelpers、Common ExtensionMethods 等.

At the company I work for we have a "Utility" project that is referenced by pretty much ever application we build. It's got lots of things like NullHelpers, ConfigSettingHelpers, Common ExtensionMethods etc.

我们的工作方式是,当我们想要创建一个新项目时,我们从源代码管理中获取项目的最新版本,将其添加到解决方案中,然后从添加到解决方案中的任何新项目中引用该项目.

The way we work is that when we want to make a new project, we get the latest version of the project from source control add it to the solution and then reference the project from any new projects that get added to the solution.

这行得通,但是有几个例子表明人们对共同项目进行了重大更改",这对他们有用,但对其他人不起作用.

This has worked ok, however there have been a couple of instances where people have made "breaking changes" to the common project, which works for them, but doesn't work for others.

我一直在想,与其将公共库添加为项目引用,不如开始将公共库开发为独立的 dll 并发布不同版本并针对特定项目针对特定版本进行更改不会对使用公共库的其他项目造成任何风险.

I've been thinking that rather than adding the common library as a project reference perhaps we should start developing the common library as a standalone dll and publish different versions and target a particular version for a particular project so that changes can be made without any risk to other projects using the common library.

说了这么多,我很想看看其他人如何引用或使用他们的公共库.

Having said all that I'm interested to see how others reference or use their common libraries.

推荐答案

这正是我们正在做的.我们有一个实用程序项目,它具有一些非项目特定的有用功能.我们手动增加版本(次要),在 Release 版本中构建项目,对其进行签名并将其放到共享位置.

That's exactly what we're doing. We have a Utility project which has some non project specific useful functions. We increase the version manually (minor), build the project in Release version, sign it and put it to a shared location.

然后人们使用的特定版本.

People then use the specific version of the library.

如果在某些特定项目中实现了一些有用的方法,可以找到它们进入主实用程序项目的方法,我们将其放在项目中的特殊帮助类中,并将它们标记为可能的实用程序候选者(简单的//TODO).在项目结束时,我们会审查候选人,如果他们坚持下去,我们会将他们移至主.

If some useful methods are implemented in some specific projects which could find their way into main Utility project, we put the to a special helper class in the project, and mark them as a possible Utility candidate (simple //TODO). At the end of the project, we review the candidates and if they stick, we move them to the main library.

重大更改是禁忌,如果需要,我们将方法和类标记为 [Obsolete].

Breaking changes are a no-no and we mark methods and classes as [Obsolete] if needed.

但是,这并不重要,因为我们在每次发布时都会增加版本.

But, it doesn't really matter because we increase the version on every publish.

希望这会有所帮助.

这篇关于使用通用/实用程序库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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