外部DLL文件存放在哪里?

发布于 2024-10-04 23:15:29 字数 126 浏览 2 评论 0原文

在我的项目中,我使用了一些第三方库。我使用 Visual Studio 中的引用文件夹包含它们。

但是我应该将 DLL 文件保存在哪里呢?它们是从文件系统中的路径引用的,但如果我可以将其包含到项目中,那就太好了。但如何呢?

In my project I'm using some third-party libraries. I include them using the references folder in Visual Studio.

But where should I save the DLL files? They are referenced from a path in the file system, but it would be nice if I can include it into the project. But how?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(8

全部不再 2024-10-11 23:15:29

这就是我所做的:

  • 在解决方案级别创建一个 lib 文件夹
  • 下载并复制所有第三方 DLL 文件到其中
  • 从 lib 文件夹引用
  • 将所有这些 DLL 文件放入源代码管理中。我正在使用 Subversion,并且我手动添加它们,但这是一次性的。

您还可以添加解决方案文件夹并将其添加到其中。


更新2012-12-19

上面的答案是时NuGet 还处于起步阶段。 FWIW,我的方法是,我们有 NuGet 项目:

  1. 对纯 DLL 文件依赖项执行上述操作(它们没有 NuGet pkg)
  2. 为解决方案启用“包还原”
  3. 如果满足以下条件,请更改 packages.config 文件将版本锁定到特定包的需要
  4. 不要将包本身存储在版本控制系统中(为 Git 设置忽略Mercurial 等)

我实际上使用 NuGet 来管理甚至内部依赖项并拥有私有源。

This is what I do:

  • Create a lib folder at the solution level
  • Download and copy all my third-party DLL files into there
  • Reference from the lib folder
  • Put all those DLL files in the source control. I am using Subversion, and I add them manually but this is one-off.

You can also add a solution folder and add them there.


UPDATE 2012-12-19

The answer above was when NuGet was in infancy. FWIW, my approach where we have NuGet items:

  1. Do as above for plain DLL file dependencies (where they don't have a NuGet pkg)
  2. Enable "Package Restore" for the solution
  3. Change packages.config file if needed to lock down the version to a particular package
  4. Do not store the package themselves in the version control system (set ignore for Git, Mercurial, etc.)

I actually use NuGet for managing even internal dependencies and have a private feed.

一抹淡然 2024-10-11 23:15:29

通常,我的项目结构如下所示(至少):

projectname
   - trunk
       - src
       - lib
   - support
       - docs
   - releases

trunk 文件夹包含我现在正在处理的源代码的副本。另外,还有一个目录“lib”,其中包含我的项目引用的所有第三方程序集。
(我参考了该位置的程序集)。

“releases”文件夹包含主干的分支。例如,当 v1 发布时,会从主干中取出一个分支,以便我拥有构建应用程序版本 1 所需的源代码及其所有依赖项的副本。 (这对于错误修复很方便。修复该分支中的错误,将修复合并到主干,重建该分支,然后您的应用程序就有了一个修复的 v1)。

所有这些都进入源代码控制。 (是的,还有引用的程序集)。通过这样做,如果其他同事也必须参与该项目,那就很容易了。他刚刚从源代码管理中获取最新版本,并且他(或她)已经准备好一切以便能够编译和构建。

(请注意,如果您对 持续集成)。

Typically, the structure of my projects looks like this (at a minimum):

projectname
   - trunk
       - src
       - lib
   - support
       - docs
   - releases

The trunk folder contains the copy of the source that I am working on right now. Also, there's a directory 'lib', which contains all the third-party assemblies that are referenced by my project.
(I reference the assemblies at that position).

The 'releases' folder contains branches of the trunk. For instance, when v1 is released, a branch is taken of the trunk so that I have a copy of the source code and all its dependencies that is necessary to build version 1 of the application. (This is handy for bugfixes. Fix the bug in that branch, merge the fix to the trunk, rebuild that branch and you have a fixed v1 of your application).

All these things go into source control. (Yes, the referenced assemblies as well). By doing so, it is very easy if another colleague has to work on the project as well. He just gets the latest version from source-control, and he (or she) has everything in place in order to be able to compile and build).

(Note that this is also true if you use something like CruiseControl for continuous integration).

谜兔 2024-10-11 23:15:29

在 Visual Studio 的属性窗口中,用于引用 dll,有一个名为“Copy Local”的属性 - 将其设置为 true,它们将被复制到本地项目的 bin 目录中

In the properties window of Visual Studio for the reference to the dll, there is a Property called 'Copy Local' - set this to true, and they'll be copied to your local project's bin directory

素手挽清风 2024-10-11 23:15:29

看一下 NuGet(Visual Studio 的包管理器)...

NuGet 是一个 Visual Studio 扩展,可以轻松安装和使用
更新 Visual Studio 中的开源库和工具。

然后阅读此 NuGet 文档以获取crème de la crème

使用 NuGet 而不将包提交到源代码管理

Take a look at NuGet (package manager for Visual Studio)...

NuGet is a Visual Studio extension that makes it easy to install and
update open source libraries and tools in Visual Studio.

Then read this NuGet doc to get the crème de la crème:

Using NuGet without committing packages to source control

雨落星ぅ辰 2024-10-11 23:15:29

您应该查看 NuGet。它是 Visual Studio 2010 的包管理扩展,专为您的需求而设计。

You should look at NuGet. It's a package management extension for Visual Studio 2010 designed exactly for what you want.

人事已非 2024-10-11 23:15:29

请查看 Tree Surgeon - 为 . NET 项目,这可能是一个很好的起点,您可以从那里即兴发挥。

Do have a look at Tree Surgeon - Creates a development tree for a .NET project, which can be a good starting point and from there you can improvise.

城歌 2024-10-11 23:15:29

就我个人而言,我的源代码管理中有一个用于第 3 方 DLL 的文件夹(每个公司、组织都有一个文件夹),并从那里引用它们。

然后,所有下载源代码的开发人员都可以使用这些文件,并且可以轻松更新。

Personally, I have a folder in my source control for 3rd party DLLs (with a folder for each company, organisation) and reference them from there.

These files are then available for all developers who download the source and can be updated easily.

梦里人 2024-10-11 23:15:29

要正确回答这个问题,您需要区分环境工作集

环境

  • 这是构建解决方案所需的所有工具和库。
  • 环境中的事物预计会保持相当稳定。
  • 环境中的事物通常是版本化的,并且您应该能够并排拥有多个版本。
  • 环境中的事物通常是经过许可的。
  • 环境不受源代码控制。
  • Visual Studio 就是一个很好的例子。

工作集:

  • 这基本上是您的源代码。
  • 这是获得最终可执行文件所需的所有要求。
  • 您应该预期工作集在开发过程中会发生很大变化。
  • 工作集应处于源代码控制之下。

您需要决定您的组件适合哪个类别。

To answer this properly you need to differentiate between the environment and working set.

Environment:

  • This is all the tools and libraries required to build your solution.
  • Things in the environment are expected to stay reasonably constant.
  • Things in the environment are usually versioned and you should be able to have multiple versions side by side.
  • Things in the environment are usually licensed.
  • Environment is not under source control.
  • A good example would be Visual Studio.

Working Set:

  • This is basically your source code.
  • It is all the requirements needed to get to your final executable.
  • You shuold expect the working set to change a lot during development.
  • The working set should be under source control.

You need to decide into which category your component fits.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文