I have previously posted about when TFS build controllers don’t start properly. Well I saw the same problem today whilst upgrading a TFS 2010 server to TFS 2012.3. The client did not want to immediately upgrade their build processes and decided to keep their 2010 build VMs just pointing them at the updated server (remember TFS 2012.2 and later servers can support either 2012 or 2010 build controllers).

The problem was that when we restarted the build service the controller and agents appeared to start, but then we got a burst of errors in the event log and we saw the controller say it was ready, but have the stopped icon.

On checking the Windows error log we saw the issue was it could not load the assembly

Exception Message: Problem with loading custom assemblies: Could not load file or assembly ‘Microsoft.VisualStudio.Shell, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a’ or one of its dependencies. The system cannot find the file specified. (type Exception)

Turns out this was because the StyleCop.VSPackage.dll has been checked into the build controllers CustomAssemblies folder (how and why we never found out, also why it had not failed before was unclear as it was checked in about 6 weeks ago!). Anyway as soon as the DLL was removed from the custom assemblies folder, leaving just the StyleCop files from the c:program Files (x86)|StyleCop4.7 folder all was OK.