This might be the last of the Ten Commandments
but it’s a really, really important one. When an app has
external dependencies which are required for it to successfully
build and run, get them into source control! The problem people
tend to have is that they get everything behaving real nice in
their own little environment with their own settings and their own
local dependencies then they commit everything into source control,
walk away and think things are cool. And they are, at least until
someone else who doesn’t have some same local decencies
available pulls it down and everything fails
catastrophically.
I was reminded of this myself today when I pulled
an old project out of source control and tried to build it:
I’d worked on the assumption that NUnit
would always be there on the machine but this time that
wasn’t the case. Fortunately the very brilliant NuGet bailed
me out quickly, but it’s not always that easy and it does
always take some fiddling when you start discovering that
dependencies are missing. In some cases, they’re not going to
be publicly available and it can be downright painful trying to
track them down.
I had this happen just recently where I pulled
down a project from source control, went to run it and discovered
there was a missing assembly located in a path that began with
“c:\Program Files…”. I spent literally hours
trying to track down the last guy who worked on this (who of course
was on the other side of the world), get the assembly, put it in a
“Libraries” folder in the project and actually get it
into VCS so the next poor sod who comes across the project
doesn’t go through the same pain.
Of course the other reason this is very important
is that if you’re working in any sort of continuous
integration environment, your build server isn’t going to
have these libraries installed. Or at least you shouldn’t be
dependent on it. Doug Rathbone made a good point about this
recently when he wrote about Third party tools live in your source
control. It’s not always possible (and we had some good
banter to that effect), but it’s usually a pretty easy
proposition.
So do everyone a favour and make sure that
everything required for your app to actually build and run is in
VCS from day 1.
With modern day projects much better integrating
with resources like NuGet to automatically pull down dependencies,
these shouldn't be checked into source control. Most modern build
runners will automatically grab them and versioning third party
assemblies that are easily obtained from package management systems
merely pollutes the repository. Still check in those that you can't
automatically retrieve at build time though. tl;dr - main priority
is that someone else can check out the project and immediately run
it.