将第 3 方库添加到 Visual Studio 源代码管理
这个问题已经困扰我一段时间了,我只是还没有找到一个好的解决方案(没有双关语)。
我正在使用带有 Subversion 和 Ankhsvn 的 Visual Studio 2010。它工作得很好,但是,我最大的问题是它只检索和管理“包含在项目中”的文件。这在许多情况下都很棒,但是当您想要一个包含要包含在解决方案中的对象的文件夹,但又不想将其包含在项目本身(在本例中为 Web 项目)中时,这就有点糟糕了。
在这种情况下,我想将一些第 3 方 DLL 包含到源代码管理中(以便它们在与版本控制同步时可以保持最新)。我不希望开发人员必须单独安装第 3 方 dll。通常发生的情况是,您从其他位置引用 DLL,并且它们在编译时被复制到您的 bin 文件夹中。
我不希望将它们包含在项目中,因为我不希望在发布站点时将它们复制到网络服务器(除了通过它们应该所在的 bin 目录)。我想过为这些创建一个单独的项目,但这会创建一个无用的 dll,没有任何用途,然后会被复制到 bin 文件夹,因为它被引用了。
我也尝试从 bin 文件夹中签入它们,但这导致了许多问题,其中文件没有正确同步,颠覆说存在已经存在的版本文件夹等。这似乎是颠覆或ankhsvn 问题而不是 Visual Studio 问题。因此,我尝试保持 bin 文件夹不受版本控制的影响。
您是如何在项目中解决这个问题的?
This is a problem that has been eating at me for a while, and I just haven't found a good solution (no pun intended) for it.
I'm using Visual Studio 2010 with Subversion and Ankhsvn. It works very well, however, my biggest problem with it is that it only retrieves and manages files that are "included in the project". This is great in many situations, but kind of sucks when you want a folder with objects that you want to include in the solution, but do not want to have in the project itself (in this case a web project).
In this case, I want to include some 3rd party DLL's into source control (so they can be kept up to date when syncronizing with version control). I don't want the developers to have to install the 3rd party dll's seperately. What normally happens is that you reference the DLL's from some other location and they get copied into your bin folder at compile time.
I do not wish to include them in the project because i don't wan them copied to the web server when I publish the site (other than via the bin directory where they should be). I thought of creating a seperate project for these, but that would create a useless dll with no purpose that would then get copied to the bin folder because it's referenced.
I've also tried to check them in from the bin folder, but this has caused a number of problems where files did not syncronize prolerly, with subversion saying things about an already version folder being present etc.. This seems to be a subversion or ankhsvn problem rather than a visual studio one. As such, i try to keep the bin folder untouched by version control.
How have you solved this problem in your projects?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这就是我们在项目中的做法。
我们有一个 SourceCode 文件夹,其中包含包含代码的项目的子文件夹。
此外,它还有一个名为 Library 的文件夹,其中包含我们使用的任何第 3 方 dll 的正确版本。此文件夹位于版本控制中,因此每个人始终拥有正确版本的第 3 方 dll
项目中对第 3 方 dll 的所有引用都与此 Library 文件夹相关。
由于每个人的计算机上都有 SourceCode 文件夹,因此它可以正常工作,没有任何问题。
编辑:
添加了包含库内容的解决方案文件夹的图像
This is how we do it in our project.
We have a SourceCode folder which has the subfolders for the projects which contain the code.
Additionally this has a folder called Library which has the correct version of any 3rd party dll's that we use. This folder in in version control and hence everyone always has the correct version of the 3rd party dll's
All references in the projects to 3rd party dll's are relative from this Library folder.
Since everyone has the SourceCode folder on their machine, it works fine with no issues.
EDIT:
Added image of Solution Folder with library contents to it