TFS and referenced DLLs

陌路散爱 提交于 2020-07-31 15:56:59

问题


We are using TFS and VS 2010.

I have been working on a project that is using TFS as source control. I have quite a few dlls that I have downloaded (such as log4net) and referenced in my project.

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.

What did I do wrong here? How can I include those referenced DLLs in source control. Do I need to add all these dlls to my project before referencing them? when I referenced them, I just browsed to where they were on my file system.


回答1:


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. You'll also want to make sure these DLLs are checked into source control. This way, everyone who works on the project gets the exact same versions of all DLLs, and the reference paths are exactly the same.

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. Also, if everyone references DLLs outside of the project structure, it's harder to guarantee that everyone's on the same version.

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.




回答2:


I created a "ThirdPartyDLL" folder in my project folder in which I copied all the extra DLLs into it. 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).

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. You will then see the "ThirdPartyDLL" folder appear in that window.

Once this is done, those dlls are in the team foundation source control. Whenever a dev checks in, they will get the most current version of the DLLs.

Don't forget to remove the old references in your app and change them to your thirdpartydll folder.

I used to copy the DLLs into the bin folder but the issue I ran into was when the DLLs got upgraded. 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. My best example is the licensing dll I purchased. 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.




回答3:


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.




回答4:


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. 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. 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.




回答5:


My workaround...make sure everything is checked in, get latest version and copy the folder with the functioning code that contains everything (i.e. solution, project(s), DLLs, etc). Give that copy to the developer that needs it. Then in TFS explorer, have that developer map to the folder they copied. TFS will say there is a conflict and ask if you want to merge. I just choose to overwrite. TFS won't have the third party DLLs but that's fine because you copied them over from the working version and now just created the binding to check in/out items. In other words, you should have everything now using this approach.



来源:https://stackoverflow.com/questions/3971377/tfs-and-referenced-dlls

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!