简体   繁体   English

TFS 和引用的 DLL

[英]TFS and referenced DLLs

We are using TFS and VS 2010.我们正在使用 TFS 和 VS 2010。

I have been working on a project that is using TFS as source control.我一直在研究一个使用 TFS 作为源代码控制的项目。 I have quite a few dlls that I have downloaded (such as log4net) and referenced in my project.我下载了很多 dll(例如 log4net)并在我的项目中引用。

When a new programmer connected to TFS and got my project out of source control, it failed to build as it said it was missing all these referenced dlls.当一个新程序员连接到 TFS 并使我的项目脱离源代码控制时,它无法构建,因为它说它缺少所有这些引用的 dll。

What did I do wrong here?我在这里做错了什么? How can I include those referenced DLLs in source control.如何在源代码管理中包含那些引用的 DLL。 Do I need to add all these dlls to my project before referencing them?在引用它们之前,我是否需要将所有这些 dll 添加到我的项目中? when I referenced them, I just browsed to where they were on my file system.当我引用它们时,我只是浏览到它们在我的文件系统中的位置。

I've found the best practice for 3rd party DLLs is to create a "Library" folder in your sln/proj file structure and copy all the necessary DLLs into this local folder for reference.我发现 3rd 方 DLL 的最佳实践是在 sln/proj 文件结构中创建一个“Library”文件夹,并将所有必要的 DLL 复制到此本地文件夹中以供参考。 You'll also want to make sure these DLLs are checked into source control.您还需要确保将这些 DLL 签入源代码管理。 This way, everyone who works on the project gets the exact same versions of all DLLs, and the reference paths are exactly the same.这样,参与项目的每个人都会获得所有 DLL 的完全相同版本,并且引用路径完全相同。

Referencing 3rd party libs in a arbitrary download or install location will be problematic, because it will require all developers to maintain the same download structure for all DLLs.在任意下载或安装位置引用第 3 方库会出现问题,因为它需要所有开发人员为所有 DLL 维护相同的下载结构。 Also, if everyone references DLLs outside of the project structure, it's harder to guarantee that everyone's on the same version.此外,如果每个人都在项目结构之外引用 DLL,则很难保证每个人都使用相同的版本。

The other option would be to have everyone install the DLLs into the GAC, but that can be a real pain too, especially with version management and deployment.另一种选择是让每个人都将 DLL 安装到 GAC 中,但这也可能是一个真正的痛苦,尤其是在版本管理和部署方面。

I created a "ThirdPartyDLL" folder in my project folder in which I copied all the extra DLLs into it.我在我的项目文件夹中创建了一个“ThirdPartyDLL”文件夹,我将所有额外的 DLL 复制到其中。 I then went into source explorer and added those DLLs into the team foundation server so I could be sure I'm using the correct versions of the DLLS for specific versions of my application (and so everyone else is on the exact same page as I am).然后我进入源资源管理器并将这些 DLL 添加到团队基础服务器中,这样我就可以确定我正在为我的应用程序的特定版本使用正确版本的 DLLS(因此其他人都在与我完全相同的页面上) )。

View - other windows - Source coontrol explorer Right click project folder - add items to folder查看-其他窗口-源控制资源管理器右键单击项目文件夹-将项目添加到文件夹

You won't be able to select a specific folder with DLLs in it, but instead you can select the individual DLL files within the folder.您将无法选择包含 DLL 的特定文件夹,但您可以选择该文件夹中的单个 DLL 文件。 You will then see the "ThirdPartyDLL" folder appear in that window.然后您将看到“ThirdPartyDLL”文件夹出现在该窗口中。

Once this is done, those dlls are in the team foundation source control.完成此操作后,这些 dll 位于团队基础源代码管理中。 Whenever a dev checks in, they will get the most current version of the DLLs.每当开发人员签入时,他们将获得最新版本的 DLL。

Don't forget to remove the old references in your app and change them to your thirdpartydll folder.不要忘记删除应用程序中的旧引用并将它们更改为您的第三方dll 文件夹。

I used to copy the DLLs into the bin folder but the issue I ran into was when the DLLs got upgraded.我曾经将 DLL 复制到 bin 文件夹中,但我遇到的问题是 DLL 升级时。 Initially when my project was small it wasn't a big deal.最初,当我的项目很小时,这没什么大不了的。 Now that I have multiple DLLs and applications that I created it became very difficult to maintain consistent versions of DLLs outside my project.现在我创建了多个 DLL 和应用程序,在我的项目之外维护 DLL 的一致版本变得非常困难。 My best example is the licensing dll I purchased.我最好的例子是我购买的许可 dll。 When this got upgraded all applications and libraries needed to be on the same version.升级后,所有应用程序和库都需要在同一版本上。 If I forgot one then I had weird issues or the application just stopped working.如果我忘记了一个,那么我就会遇到奇怪的问题或者应用程序停止工作。 Now that I have everything in one folder, I make the change once and everything is upgraded.现在我将所有内容都放在一个文件夹中,我进行了一次更改并升级了所有内容。

Hope this helps.希望这可以帮助。

Andy's suggestion is a good one and I've used that in the past.安迪的建议很好,我过去曾使用过。 At my current job, we have a "reference" folder on a network share for all of us to build from.在我目前的工作中,我们在网络共享上有一个“参考”文件夹,供我们所有人构建。 We have a very fast network here, though and all developers are in a single office.不过,我们这里的网络非常快,所有开发人员都在一个办公室。 This solution won't work as well if you have a lot of remote developers or a slow network.如果您有很多远程开发人员或网络速度较慢,则此解决方案将无法正常工作。

I've tried various methods for dealing with this and have settled on dropping required dll's in the bin folder and making sure they are included in the project for source control.我已经尝试了各种方法来解决这个问题,并决定将所需的 dll 放在 bin 文件夹中,并确保它们包含在项目中以进行源代码控制。 I've heard people say this might not be a good idea but nobody has provided good reasoning for it and it's worked well for me.我听说有人说这可能不是一个好主意,但没有人为此提供充分的理由,而且对我来说效果很好。

My second choice would be to carve out some space on a network share and organize the various 3rd party dll's there.我的第二个选择是在网络共享上开辟一些空间并在那里组织各种 3rd 方 dll。 You can put your files in folders with verion numbers to keep things straight and everyone should have access to everything they need, so long as everyone uses the normal network paths as a reference.您可以将您的文件放在带有版本号的文件夹中,以保持一切正常,只要每个人都使用正常的网络路径作为参考,每个人都应该可以访问他们需要的一切。

Adding a seperate folder within the project is also workable but seems messy, since you end up with extra files that you don't want included in your release.在项目中添加一个单独的文件夹也是可行的,但看起来很麻烦,因为您最终会得到不希望包含在您的版本中的额外文件。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM