外部DLL文件存放在哪里?
在我的项目中,我使用了一些第三方库。我使用 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(8)
这就是我所做的:
您还可以添加解决方案文件夹并将其添加到其中。
更新2012-12-19
上面的答案是时NuGet 还处于起步阶段。 FWIW,我的方法是,我们有 NuGet 项目:
packages.config
文件将版本锁定到特定包的需要我实际上使用 NuGet 来管理甚至内部依赖项并拥有私有源。
This is what I do:
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:
packages.config
file if needed to lock down the version to a particular packageI actually use NuGet for managing even internal dependencies and have a private feed.
通常,我的项目结构如下所示(至少):
trunk
文件夹包含我现在正在处理的源代码的副本。另外,还有一个目录“lib”,其中包含我的项目引用的所有第三方程序集。(我参考了该位置的程序集)。
“releases”文件夹包含主干的分支。例如,当 v1 发布时,会从主干中取出一个分支,以便我拥有构建应用程序版本 1 所需的源代码及其所有依赖项的副本。 (这对于错误修复很方便。修复该分支中的错误,将修复合并到主干,重建该分支,然后您的应用程序就有了一个修复的 v1)。
所有这些都进入源代码控制。 (是的,还有引用的程序集)。通过这样做,如果其他同事也必须参与该项目,那就很容易了。他刚刚从源代码管理中获取最新版本,并且他(或她)已经准备好一切以便能够编译和构建。
(请注意,如果您对 持续集成)。
Typically, the structure of my projects looks like this (at a minimum):
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).
在 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
看一下 NuGet(Visual Studio 的包管理器)...
然后阅读此 NuGet 文档以获取crème de la crème:
使用 NuGet 而不将包提交到源代码管理
Take a look at NuGet (package manager for Visual Studio)...
Then read this NuGet doc to get the crème de la crème:
Using NuGet without committing packages to source control
您应该查看 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.
请查看 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.
就我个人而言,我的源代码管理中有一个用于第 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.
要正确回答这个问题,您需要区分环境和工作集。
环境:
工作集:
您需要决定您的组件适合哪个类别。
To answer this properly you need to differentiate between the environment and working set.
Environment:
Working Set:
You need to decide into which category your component fits.