Showing posts with label CI. Show all posts
Showing posts with label CI. Show all posts

Saturday, September 13, 2008

How to reference DLL’s in your .Net projects, don’t assume anything

“How great is this I just found this cool library; it fits perfectly in my current project, it even comes with an installer so I can reference it straight away?” So how are you going to provide this to your team members? “Well we have a shared folder that contains all our third party installers.”

What is wrong with this scenario?

Well every time you get a new developer on your team you have to make sure that he has all the third party libraries installed, and make sure that they are of the correct version. If you have got all the installers placed together than this is not the worst thing, but in reality you are probably missing one or two, or you don’t exactly know what is required, this is not your only project is it?

So let’s say you got the new guy up and running, it took both of you about half an hour just to get the source to compile. The new guy has to fix a bug and sees there is an update for library xyz. This update is exactly what he needs, so he downloads it installs it, compiles the code and checks in the changes. Now suddenly all other developers who updated their code need the new library to be able to compile. But which version did the new guy actually use; he went home to take an early weekend. Your Continuous Integration process also immediately stopped working because the new guy didn’t install the new version on there either. Didn’t we tell him to do that?

That’s what’s wrong.

What to do about it? Well create a folder “Libraries” in your solution and place all the needed third party libraries in there. And I basically mean everything that doesn’t come with the default .Net Framework installation. Then create absolute references to these libraries (Add reference – Open Browse tab – Find your “Libraries” folder – Select the DLL’s to include). Check-in the changes including all third party libraries, you are using a version control system right? Now when ever, where ever you check out your code you can instantly compile it. One quick way to get all the needed DLL’s is to Publish the solution, then just copy every non project DLL into the new “Libraries” folder.

But I have an ASP.Net website project and don’t have a reference folder or even a project file in my project. I really dislike the decision of Microsoft to provide projects without actual project files. In that case I would suggest using a Web Application project and include all needed files and libraries in there manually.

So the lesson is: “Don’t assume everybody is using the same DLL version, make sure everybody is using the same DLL version”.