您应该在哪里存放第 3 方程序集? [英] Where should you store 3rd party assemblies?

查看:22
本文介绍了您应该在哪里存放第 3 方程序集?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

好的,所以我们有一个相当大的解决方案,其中包含大约 8 个不同的项目.这些项目中的每一个都依赖于各种不同的 3rd 方程序集.此解决方案位于源代码管理的主干分支中.我们还有大约 5 个不同的树干分支.

Okay, so we have a rather large solution with about 8 different projects inside it. Each of these projects depend on various different 3rd party assemblies. This solution is in the trunk branch of source control. We also have about 5 different branches off of trunk.

管理这些 3rd 方程序集的最佳方式是什么?当您添加对程序集的引用,然后单击它并查看属性窗口时,我注意到它有一个到程序集的硬编码路径.

What is the best way to manage these 3rd party assemblies? When you add a reference to an assembly and then click it and view the properties window I notice that it has a hard coded path to the assembly.

例如:我们所有的分支都映射到C:\Code\".所以主干将是C:\Code\Trunk",分支将是C:\Code\somebranch".

For example: All our branches are mapped to "C:\Code\". So trunk would be "C:\Code\Trunk" and a branch would be "C:\Code\somebranch".

如果我在C:\Code\Trunk"中创建一个名为Assemblies"的文件夹,然后将我们所有的 3rd 方程序集放在该文件夹中,然后我添加对程序集的引用,该程序集引用是否相对?如果我单击添加的程序集,我会看到灰色的路径属性显示C:\Code\Trunk\Assemblies\someassembly.dll".

If I create a folder in "C:\Code\Trunk" called "Assemblies" and then drop all our 3rd party assemblies in that folder, and then I add a reference to an assembly in there is that assembly reference relative? If I click the added assembly I see the grayed out path property says "C:\Code\Trunk\Assemblies\someassembly.dll".

如果我从主干分支出来会怎样?somebranch"仍然会引用C:\Code\Trunk\Assemblies\someassembly.dll"还是会引用C:\Code\somebranch\Assemblies\someassembly.dll"?

What happens if I then branch off of trunk? Would "somebranch" still have a reference to "C:\Code\Trunk\Assemblies\someassembly.dll" or would it then reference "C:\Code\somebranch\Assemblies\someassembly.dll"?

目前我们实际上在源代码管理中有一个名为Assemblies"的分支,就像任何其他分支一样,它被映射到C:\Code\".因此,所有项目引用程序集的分支都引用了C:\Code\Assemblies\someassembly.dll",无论项目在哪个分支,路径都是相同的.

Currently we actually have a branch in source control called "Assemblies" which is mapped, just like any other branch, to "C:\Code\". So all branches with projects referencing assemblies have references to "C:\Code\Assemblies\someassembly.dll" no matter which branch the project is in, the path would be the same.

不幸的是,这意味着您必须获得您正在工作的分支和程序集分支的最新版本,才能成功构建解决方案.

Unfortunately this means that you have to get the latest version of the branch you are working in AND the assemblies branch in order to get the solution to build successfully.

总结一下:

  • 如何添加与解决方案相关的引用?(即添加对 C:\Code\Trunk\Assemblies\someassembly.dll 的引用,并使该路径相对于添加它的项目,以便在创建分支时它引用分支的程序集文件夹而不是主干的程序集文件夹.或者这个引用已经是相对的了吗?

  • How do you add a reference that is relative to the solution? (i.e. Add a reference to C:\Code\Trunk\Assemblies\someassembly.dll and have that path be relative to the project that added it, so that when creating a branch it references the branched assemblies folder and not trunk's assemblies folder. Or is this reference already relative?

管理 3rd 方程序集的其他推荐策略是什么?

What are other recommended strategies for managing 3rd party assemblies?

推荐答案

是的,使用主干之外的程序集文件夹.我喜欢名称 lib 比程序集更好.

Yes use an assemblies folder off of the trunk. I like the name lib better then assemblies.

是的,路径已经是相对的.分支时,您的项目将获得正确的程序集文件夹.

Yes the path is already relative. When you branch your projects will get the correct assemblies folder.

根据您使用的第三方程序集的数量,您还希望组织您的程序集文件夹,这样它就不会是一大堆 dll.

Depending on how many third party assemblies you are using you make also want to organize your assemblies folder so it is not one big mess of dlls.

这篇关于您应该在哪里存放第 3 方程序集?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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