你把第三方图书馆放在哪里?

时间:2022-12-31 04:51:34

I've got a bunch of .dll assemblies, such as HtmlAgilityPack and MoreLinq. Where am I supposed to put these files? I usually toss them somewhere in my Projects folder, but then I'm always digging around for them. Is there a standard place to put them?

我有一堆.dll程序集,比如HtmlAgilityPack和MoreLinq。我应该把这些文件放在哪里?我通常把它们放在我的项目文件夹里,但是我总是在找它们。有标准的地方放置它们吗?

7 个解决方案

#1


14  

There's no standard place to put them, but make sure you:

没有标准的地方来放置它们,但是一定要确保:

  • Put them in one place
  • 把它们放在一个地方
  • Include them in source control.
  • 将它们包含在源代码控制中。

I put all my required dll's in a top level directory in my solution called "Dependencies", parallel to the project folders. I have them in source control such that when new developers check out the solution, it all compiles and works right off. It's the only way to go.

我将所有需要的dll放在我的解决方案“依赖项”的顶层目录中,与项目文件夹并行。我将它们放在源代码控制中,这样当新的开发人员检查解决方案时,它就会立即编译并工作。这是惟一的方法。

I include only the .dll files absolutely needed. This keeps it light, which is good, but then when I find some other part of MVC Contrib or whatever that I need, I have to go find the unzipped directory, which might not even be on my computer! Others put entire library directories (readme.txt and all) as part of their source control linked to the solution. This ensures you and future developers will have everything they need, but adds a little dead weight. Either is a good strategy.

我只包含了绝对需要的.dll文件。这使它保持轻便,这很好,但是当我找到MVC设计的其他部分或任何我需要的东西时,我必须找到解压目录,它甚至可能不在我的计算机上!另一些则放置整个库目录(readme)。txt和all)作为链接到解决方案的源代码控件的一部分。这确保了您和未来的开发人员将拥有他们所需的一切,但是增加了一些负担。这两种策略都是很好的策略。

#2


11  

Having a "Lib" folder at the same level as source projects is a common way.

在与源项目相同的级别上拥有一个“Lib”文件夹是一种常见的方式。

To be honest, it's not the dependencies my projects have that I find hard to manage, it's the dependencies the dependencies have. I'd just like to mention NHibernate, Castle Windsor and the various Castle Windsor Facilities in particular. Getting all of those to play together on my last project cost me a lot of time.

老实说,我发现很难管理的不是我的项目的依赖项,而是依赖项的依赖项。我想特别提一下NHibernate,温莎城堡和各种温莎城堡设施。在上一个项目中,我花了很多时间让所有的人都参与进来。

For open source projects, I also like to have the source code handy because sometimes its useful to debug into the source code. (And sometimes because the documentation is so poor, you have to read the source code to find out how it works). I've seen VS projects arranged so that the project references the DLL yet at the same time, VS knows where to find the source code, as I write I can't quite remember how to do that.

对于开放源码项目,我也喜欢使用源代码,因为有时候调试源代码是很有用的。(有时因为文档很差,您必须阅读源代码以了解它是如何工作的)。我见过VS项目被安排,项目引用DLL同时,VS知道在哪里找到源代码,当我写的时候我不太记得怎么做。

So, a Lib folder for DLLs works for me; I often call it "Shared Dependencies".

因此,dll的Lib文件夹对我是有效的;我经常称之为“共享依赖”。

As for open-source source code, I don't have a standard way to version that because each project is structured differently and has a different build process. I don't like to tinker with the open-source project structure or build method because then, I take responsibility for it. If for some reason, it won't build, or builds incorrectly, or produces a faulty DLL, the cause would be exceedingly difficult to track down, and I'd have to get deep into troubleshooting all of that which I dont care about at all.

至于开源源代码,我没有标准的版本方法,因为每个项目的结构不同,构建过程也不同。我不喜欢修改开源项目结构或构建方法,因为这样,我就承担了责任。如果由于某种原因,它不会构建,或者构建不正确,或者生成一个错误的DLL,那么原因将非常难以找到,我将不得不深入到所有我根本不关心的故障排除中。

#3


5  

In a folder UNDER your solution directory, e.g. "external" or "library". That way your continuous integration system (or other team members) can do a pull of one root from your source control system and have everything they need.

在你的解决方案目录下的文件夹中。“外部”或“图书馆”。这样,您的持续集成系统(或其他团队成员)就可以从您的源代码控制系统中提取一个根,并获得所需的一切。

In SVN, use svn:externals to pull that directory from a different root so you can easily share library DLLS (and library projects) between solutions.

在SVN中,使用SVN:externals从不同的根目录中提取该目录,以便在解决方案之间方便地共享库dll(和库项目)。

#4


2  

In the office we have a share on the network for referenced asseblies. These could be 3rd party or assemblies of our own that could be shared between projects.

在办公室里,我们在网络上有一份资产评估。这些可能是第三方或我们自己的程序集,可以在项目之间共享。

I also, don't like the idea of putting the dll files in source control. If all the developers have access to the share all will work fine.

我也不喜欢把dll文件放在源代码控制中。如果所有开发人员都可以访问共享,那么所有的工作都将正常进行。

#5


1  

The visual studio directory in My Documents seems like a logical place to put them. I don't know if it's the best or anything wrong with it but at least all the libraries are found in one place.

在我的文档中,visual studio目录似乎是放置它们的合理位置。我不知道它是最好的还是有什么问题,但至少所有的库都是在一个地方找到的。

%USERPROFILE%\My Documents\Visual Studio XXXX\Libraries

#6


1  

At my company we place all our shared DLL assemblies onto a network drive in a folder called Assemblies. From there, we use SyncToy to mirror changes between that folder and a folder on our local development machines (in my case C:\Assemblies with subfolders for different versions or useful third party assemblies). Using the "Reference Paths" feature of Visual Studio projects makes it very easy to select different assembly versions based only on locations.

在我的公司,我们将所有共享的DLL程序集放在称为程序集的文件夹中的网络驱动器上。从那里,我们使用SyncToy来镜像该文件夹和本地开发机器上的文件夹之间的变化(在我的例子中是C:\有不同版本或有用的第三方程序集的子文件夹的程序集)。使用Visual Studio项目的“引用路径”特性,可以很容易地根据位置选择不同的汇编版本。

For projects at home, I would definitely go with the idea mentioned by Jeff M of placing them in the Visual Studio folder under My Documents.

对于家里的项目,我肯定会赞同Jeff M提到的想法,将它们放在我的文档下的Visual Studio文件夹中。

#7


1  

I don't have a hard and fast rule on the location. However, I would encourage consistency!

我对地点没有严格的规定。然而,我鼓励一致性!

For example, I needed to to this for a small tool I'm writing for a client at the moment, so I checked their other code bases in Bitbucket which seemed to use a dependencies folder in the solution folder (alongside the other projects), so I copied that.

例如,我现在需要为客户编写一个小工具,因此我检查了Bitbucket中的其他代码基,它似乎使用了解决方案文件夹中的依赖项文件夹(与其他项目一起),所以我复制了它。

#1


14  

There's no standard place to put them, but make sure you:

没有标准的地方来放置它们,但是一定要确保:

  • Put them in one place
  • 把它们放在一个地方
  • Include them in source control.
  • 将它们包含在源代码控制中。

I put all my required dll's in a top level directory in my solution called "Dependencies", parallel to the project folders. I have them in source control such that when new developers check out the solution, it all compiles and works right off. It's the only way to go.

我将所有需要的dll放在我的解决方案“依赖项”的顶层目录中,与项目文件夹并行。我将它们放在源代码控制中,这样当新的开发人员检查解决方案时,它就会立即编译并工作。这是惟一的方法。

I include only the .dll files absolutely needed. This keeps it light, which is good, but then when I find some other part of MVC Contrib or whatever that I need, I have to go find the unzipped directory, which might not even be on my computer! Others put entire library directories (readme.txt and all) as part of their source control linked to the solution. This ensures you and future developers will have everything they need, but adds a little dead weight. Either is a good strategy.

我只包含了绝对需要的.dll文件。这使它保持轻便,这很好,但是当我找到MVC设计的其他部分或任何我需要的东西时,我必须找到解压目录,它甚至可能不在我的计算机上!另一些则放置整个库目录(readme)。txt和all)作为链接到解决方案的源代码控件的一部分。这确保了您和未来的开发人员将拥有他们所需的一切,但是增加了一些负担。这两种策略都是很好的策略。

#2


11  

Having a "Lib" folder at the same level as source projects is a common way.

在与源项目相同的级别上拥有一个“Lib”文件夹是一种常见的方式。

To be honest, it's not the dependencies my projects have that I find hard to manage, it's the dependencies the dependencies have. I'd just like to mention NHibernate, Castle Windsor and the various Castle Windsor Facilities in particular. Getting all of those to play together on my last project cost me a lot of time.

老实说,我发现很难管理的不是我的项目的依赖项,而是依赖项的依赖项。我想特别提一下NHibernate,温莎城堡和各种温莎城堡设施。在上一个项目中,我花了很多时间让所有的人都参与进来。

For open source projects, I also like to have the source code handy because sometimes its useful to debug into the source code. (And sometimes because the documentation is so poor, you have to read the source code to find out how it works). I've seen VS projects arranged so that the project references the DLL yet at the same time, VS knows where to find the source code, as I write I can't quite remember how to do that.

对于开放源码项目,我也喜欢使用源代码,因为有时候调试源代码是很有用的。(有时因为文档很差,您必须阅读源代码以了解它是如何工作的)。我见过VS项目被安排,项目引用DLL同时,VS知道在哪里找到源代码,当我写的时候我不太记得怎么做。

So, a Lib folder for DLLs works for me; I often call it "Shared Dependencies".

因此,dll的Lib文件夹对我是有效的;我经常称之为“共享依赖”。

As for open-source source code, I don't have a standard way to version that because each project is structured differently and has a different build process. I don't like to tinker with the open-source project structure or build method because then, I take responsibility for it. If for some reason, it won't build, or builds incorrectly, or produces a faulty DLL, the cause would be exceedingly difficult to track down, and I'd have to get deep into troubleshooting all of that which I dont care about at all.

至于开源源代码,我没有标准的版本方法,因为每个项目的结构不同,构建过程也不同。我不喜欢修改开源项目结构或构建方法,因为这样,我就承担了责任。如果由于某种原因,它不会构建,或者构建不正确,或者生成一个错误的DLL,那么原因将非常难以找到,我将不得不深入到所有我根本不关心的故障排除中。

#3


5  

In a folder UNDER your solution directory, e.g. "external" or "library". That way your continuous integration system (or other team members) can do a pull of one root from your source control system and have everything they need.

在你的解决方案目录下的文件夹中。“外部”或“图书馆”。这样,您的持续集成系统(或其他团队成员)就可以从您的源代码控制系统中提取一个根,并获得所需的一切。

In SVN, use svn:externals to pull that directory from a different root so you can easily share library DLLS (and library projects) between solutions.

在SVN中,使用SVN:externals从不同的根目录中提取该目录,以便在解决方案之间方便地共享库dll(和库项目)。

#4


2  

In the office we have a share on the network for referenced asseblies. These could be 3rd party or assemblies of our own that could be shared between projects.

在办公室里,我们在网络上有一份资产评估。这些可能是第三方或我们自己的程序集,可以在项目之间共享。

I also, don't like the idea of putting the dll files in source control. If all the developers have access to the share all will work fine.

我也不喜欢把dll文件放在源代码控制中。如果所有开发人员都可以访问共享,那么所有的工作都将正常进行。

#5


1  

The visual studio directory in My Documents seems like a logical place to put them. I don't know if it's the best or anything wrong with it but at least all the libraries are found in one place.

在我的文档中,visual studio目录似乎是放置它们的合理位置。我不知道它是最好的还是有什么问题,但至少所有的库都是在一个地方找到的。

%USERPROFILE%\My Documents\Visual Studio XXXX\Libraries

#6


1  

At my company we place all our shared DLL assemblies onto a network drive in a folder called Assemblies. From there, we use SyncToy to mirror changes between that folder and a folder on our local development machines (in my case C:\Assemblies with subfolders for different versions or useful third party assemblies). Using the "Reference Paths" feature of Visual Studio projects makes it very easy to select different assembly versions based only on locations.

在我的公司,我们将所有共享的DLL程序集放在称为程序集的文件夹中的网络驱动器上。从那里,我们使用SyncToy来镜像该文件夹和本地开发机器上的文件夹之间的变化(在我的例子中是C:\有不同版本或有用的第三方程序集的子文件夹的程序集)。使用Visual Studio项目的“引用路径”特性,可以很容易地根据位置选择不同的汇编版本。

For projects at home, I would definitely go with the idea mentioned by Jeff M of placing them in the Visual Studio folder under My Documents.

对于家里的项目,我肯定会赞同Jeff M提到的想法,将它们放在我的文档下的Visual Studio文件夹中。

#7


1  

I don't have a hard and fast rule on the location. However, I would encourage consistency!

我对地点没有严格的规定。然而,我鼓励一致性!

For example, I needed to to this for a small tool I'm writing for a client at the moment, so I checked their other code bases in Bitbucket which seemed to use a dependencies folder in the solution folder (alongside the other projects), so I copied that.

例如,我现在需要为客户编写一个小工具,因此我检查了Bitbucket中的其他代码基,它似乎使用了解决方案文件夹中的依赖项文件夹(与其他项目一起),所以我复制了它。