Old assemblies appearing in the _PublishedWebsites directory with Team Build

I have been having a problem with a new automated CI build under Team Build that I have added to an old Visual Studio solution. The solution is fairly big, but in essence it contains a shared data type assembly, a web site front end and a back end web service. The problem was on the Team Build drop share in the _PublishedWebsitesproduced by team build I was finding a old version of the shared data type assembly. However in the release directory of the same build I found the correct newly built version of the assembly.

After much fiddling with build order and dependencies I found the problem. It was that the web service project was originally created as a VS2003 or 2005 website a good few years ago (so long ago I can't remember which); the point is it was not a web application, hence there had been a bin directory under the root in Visual Studio.

When this project was converted to a VS2008 web application this was tidied up in Visual Studio. However in the TFS source control the bin directory remained. This was not an issue when the project was build locally in Visual Studio as:

  1. Visual Studio did not pull the files down as the directory was not in the project
  2. They would have been overwritten anyway as part of the build

However on Team Build :

  1. The files did come down to the build server (due to the workspace scope)
  2. They were not over written due to Team Build having a separate source and binary paths.

So these files, in the unwanted bin folder, ended up being copied to the drop location after the newly built version of the shared assembly, as part of the copy of web site resource e.g. graphic files. The net effect being to leaving me with an old DLL in the _PublishedWebsites folder, whilst having the correct new version release directory.

This was only found in the end by detailed checking of the copy lines in the build log.