I have a large number of test builds. They all share the same VCS config and all check out to the same folder. I have split the builds up into different TeamCity projects (logical groupings) to make it easier for people to see just what they care about. I have noticed that the checkout directory on the agents gets removed more frequently than I consider necessary. I suspect that this happens when builds from different projects follow one another (even though they use a shared VCS and synching to the same checkin) because TeamCity considers the sources different because they are for different TeamCity projects.

Is this suspicion correct? Any plans to change this behavior?

We are running 4.5.2 (I know, time to update but I can't at the moment) and Perforce.

"Please note that TeamCity can automatically clean a directory on the agent after a certain idle period."

Perhaps this is the sticking point? I wonder if this logic considers only syncs for the given project and not for other projects which use the same VCS settings and VCS root. Is there any logging available which might indicate why the clean checkout is done? Is the idle period configurable?

It should write about cleaning to agent log and/or to build log.TeamCity agent writes all used directories to <agent>/work/directories.map file.By defauld, working directory may be cleaned after 14days if inactivity.Activity is calculated from build checkout directory name, with no reference to build configuration/project.

Have you explicitly defined checkout directories for build configurations?What version control was it?

Please check there is no build configuration that - has 'Clean all files before build: ' option cheched - removes all files from checkout directory - has patch application (checking out/updating sources) errors