This might sound weird but that’s exactly what we need.
By all means, TC does exactly what it supposed to do: cleanup if “Clean all files before build” is checked and clean sometimes if the box is not checked as indicated in the comment “This directory might be cleaned by TeamCity before the build”. No questions about that.
However, by somewhat poor men’s design we have a particular build that shares files with another process that has nothing to do with build itself. While we were using tf.exe this was not an issue because tf.exe does not do cleanup and files get left on the hard drive even if deleted from TFS. So unrelated processes lived happily ever after. While this might seem like a bug in tf.exe, we actually took advantage of that, hope Microsoft doesn’t fix it.
Granted, we do need to decouple things that are not part of the build but it is a big project for us as things are intertwined.
Back to the topic, is there anyway to turn directory cleanup off? Completely. Something along the lines: “This directory will never be cleanup by TeamCity before the build”.
Hopefully this can be done without writing a plugin. An "under the hood" config file change? Please?