TeamCity directory cleanup (version control setting) – never to cleanup

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?  

Comment actions Permalink


Sorry for the delay in replying.

Unless you can opt to choose "Do not checkout" checkout mode and handle checkout inside your build script there is no way to instruct TeamCity never to clean the build checkout directory.

A workaround that can be suggested is to use different directory for TeamCity-handled checkout and as the first thing in your build script to copy the content from TeamCity-controlled directory to the one you need under your control.

You can also try to minimize cases when the directory is automatically cleaned. Almost all the cases are described inside this issue.

You can also file an issue into our tracker to request protecting certain directories from deletion.

Best regards,

Yegor Yarko
Project Manager (TeamCity)
JetBrains, Inc
"Develop with pleasure!"

Comment actions Permalink

Or bite the bullet and do it right by decoupling build stuff from a non related process.  That’s what we are going to do.
Thanks for follow-up and suggestions.


Please sign in to leave a comment.