Perforce client name for multiple VCS roots pointing to different servers


I'm using TC 9.0.1. I have a build with 2 VCS roots with direct mappings in TC GUI that uses agent-side checkout. Let's say the roots are called MM and FC. MM was created first. VCS roots point to different Perforce servers. When I run the build, both roots are synced as expected. First, MM is synced, followed by FC. The sources update for MM sets P4 env variables like this:

[09:44:08][VCS Root: MM] Setting P4USER environment variable to mm
[09:44:08][VCS Root: MM] Setting P4PORT environment variable to p4server1:1666
[09:44:08][VCS Root: MM] Setting P4CLIENT environment variable to TC_p4_BUILDPC_83fd80896463e8f3_35aceced75ff3d09

I would like to have FC root actually set those variables because I want to do some p4 operations against the Perforce server it touches. I tried detaching and attaching the roots to change the order, but that had no impact.

1. Is the order of root sync based on when the roots were created (i.e. oldest first)?
2. Is there a way to control which root sets the p4 env variables?
3. What determines the client mapping being written to the P4CLIENT? No matter what I tried, it was always the lines from MM that went into the workspace, but I need the lines from FC.


1 comment
Comment actions Permalink


  Currently TeamCity doesn't play well with environment variables when several VCS Roots are used in a single build configuration.
  I've created a related issue in our tracker:, please vote/comment on it.

  Thanks for raising the problem,


Please sign in to leave a comment.