How to exclude directories when using Agent-side checkout, or is there a different way to do this.

TC: 4.0.2
vcs: Team Foundation Server

Given the vcs structure below, I want an agent to run a nant script that:
1. Updates the build number for all the contained projects to w.x.y.z (build number from TC)
2. Builds and nunit tests all the projects in $Root\Dev
3. Merges $Root\Dev into $Root\Production (done via tfs command line)
4. Branches $Root\Production into $Root\Previous Versions\w.x.y.z (done via tfs command line)

So far 1 and 2 are done and I don't foresee any major issues with 3 and 4 as we do that now from the command line.

However my problem lays in the vcs $Root. When the project runs, TC tries to download everything in the root including all the previous versions, even when they haven't changed. These files aren't needed for any of the building, branching etc. but TC downloads them becuse they are in the root. Currently this takes around 15-20 minutes and will only get worse as more versions are added. Because I'm updating files and checking them back in, I need to do Agent side vcs checkouts, so I can not use the vcs checkout rules to prevent TC from downloading all those extra files. So my question is, what is the best way to prevent all these files from downloading? Or is there a different way to accomplish what I'm trying to do.

$Root\Previous Versions
$Root\Previous Versions\
$Root\Previous Versions\\Project1
$Root\Previous Versions\\Project2
$Root\Previous Versions\
$Root\Previous Versions\\Project1
$Root\Previous Versions\\Project2
$Root\Previous Versions\....

Comment actions Permalink

We have added exluded folders support in TeamCity 4.5 EAP. You may exclude folders usgin Checkout rules. TFS should not get all sources for every update starting from that version of TeamCity.

Comment actions Permalink

OK, so I've updated to 4.5.
I added the exclusions in the checkout rules and saved them.
Text appears that says: "Exclude checkout rules are specified while "checkout on agent" mode is used. Applying these checkout rules requires additional overhead and is inefficient."
I continue anyway. Now, my agent is no longer compatable. Message is:

Agent 99
Missed VCS plugins on agent:
  • Team Foundation Server

Removing the checkout conditions has no effect. Switching to server side makes the agent compatablie again.
This is the only project that I'm using agent side checkouts on. All others are Server side and running fine.

thanks for the help in advance.

Comment actions Permalink

TFS checkout on agent is broken. Please try updating to TeamCity 4.5 release version. We plan to release in in a day. Please try server side checkout as workaround.


Comment actions Permalink

Upgraded to the release version (8944) and agent checkout with excluded paths works great.
Is there a way to use wildcards?
I want the parent directory but I do not want any of the children.
Using the structure liste above:
I want $Root\Previous Versions to exist as I'm going to branch to it, but I don't need all the versions directories under it.
Currently I would have to add a checkout rule after every build in order to exclude the newly branched directory.

I tried -:Previous Versions/*.*
but that was a no go.

Comment actions Permalink

TFS on agent supports only cloaking directories.
For you case where you need to skip all folders you will have to write a rule for each folder.

TFS checkout on agent is done by TFS workspace which supports only cloaking for explicitly specified folders.

Please feel free to post an issue to our tracker at


Comment actions Permalink

Now that I know that you are using the cloaking feature I can deal with it by using the tfs command line to uncloak the directory before I branch to it and then re-cloaking it afterwards.

Thanks for all your help.


Please sign in to leave a comment.