使共享库可供多个应用程序使用的最佳方法是什么?
与大多数商店一样,我们有一个团队负责各种项目,他们都需要访问与我们业务相关的相同核心信息和功能(通常使用 C# 语言)。目前,我们只是将公共类从一个项目复制到另一个项目,但每个人都开始有自己的风格,我们希望进行整合。
我们使用 Tortoise SVN 并决定维护一个单独的项目来包含我们的公共类,但不确定将此公共代码部署到我们的各种应用程序的最佳方法。我们为一家内部 IT 商店工作,该商店可以决定用户如何访问应用程序的一切,我们不必担心将我们的产品发布到现实世界中。
我们的一些想法是:
- 将类编译成单个 DLL 并将其加载到全局程序集缓存 (GAC)
- 将类编译成单个 DLL 并将其保存到位于中央的共享驱动器以供所有其他项目
- 引用类放入单个 DLL 中并将其包含在每个项目中
- 只需在启动项目时获取最新的类,但没有中央共享库(我们对此的解释:http://www.yosefk.com/blog/redundancy-vs -dependency-which-is-worse.html)
- SVN 外部 http://svnbook.red-bean.com/en/1.0/ch07s03.html
我知道这是一个常见问题,如果您花时间研究这些或其他选项,你总是会发现人们解释每种方法的陷阱(版本控制、回归测试、“DLL Hell”、“GAC 很糟糕”等)。我几乎找不到任何人谈论什么是有效的以及为什么有效。有优选的方法吗?
Like most shops we've got a team of people working on various projects that all need to access the same core information and functions that relate to our business, usually in C#. We're currently just copying common classes from project to project, but everyone is starting to have their own flavors and we want to consolidate.
We use Tortoise SVN and have decided to maintain a separate project to contain our common classes, but are not sure the best way to deploy this common code to our various applications. We work for an internal IT shop that can dictate everything about how the users access the applications, we don't have to worry about releasing our products into the real world.
Some of our thoughts have been:
- Compile the classes into a single DLL and load it into the Global Assembly Cache (GAC)
- Compile the classes into a single DLL and save it to a centrally located shared drive to be referenced by all other projects
- Compile the classes into a single DLL and include it in each project
- Just fetch the most recent classes when starting a project, but don't have a central shared library (our interpretation of this: http://www.yosefk.com/blog/redundancy-vs-dependencies-which-is-worse.html)
- SVN Externals http://svnbook.red-bean.com/en/1.0/ch07s03.html
I know this is a common problem, and if you spend any time looking into these or other options, you invariably find people explaining the pitfalls of each method (versioning, regression testing, "DLL Hell", "The GAC sucks", etc). I can hardly find anyone talking about what WORKS and why. Is there a preferred method?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在我的公司,我们也有同样的问题。目前,我们仅使用 .bat 文件进入 SVN Trunk 并提取最新的 .dll 引用并填充您正在处理的项目的本地引用文件夹。
不过,我们目前正在努力将此系统切换到 NuGet。我不是 100% 确定它是如何工作的,但它绝对值得研究。看起来您可以将其设置为可以将其指向共享代码存储库的位置,然后在 Visual Studio 中使用插件,就像每次需要获取最新代码时右键单击并点击“更新”一样简单。
At my company we have the same issue. Currently, we just use .bat files that go to our SVN Trunk and pull the most recent .dll references and fill a local References folder for the project you are working on.
However, we are currently working on switching this system over to NuGet. I'm not 100% sure how it works, but it's definitely worth looking into. Looks like you can set it up to where you can point it to a shared code repository, and then in Visual Studio using a plugin, it's as simple as just right clicking and hitting 'Update' everytime you need to get the newest code.