Example of the default location for the source on a build server, I have highlighted one of the longer examples:
In the TFS build Agent there is a variable that controls the start of the source location on the build server, it is called Working Directory
The default value for this is:
$(SystemDrive)\Builds\$(BuildAgentId)\$(BuildDefinitionPath)
In the build server I have this is:
C:\Builds\5\Mexia\BizTalkDemo_buildv3
The last part of this is the source tree path and the name of the build, which are typically much longer than this example.
To reduce this I found that we can change $(BuildDefinitionPath) to $(BuildDefinitionId)
$(SystemDrive)\Builds\$(BuildAgentId)\$(BuildDefinitionId)
This changes the starting path to:
C:\Builds\5\15
This is reduce the path by 13 characters, but if your source tree path and build definition name are a typical size this may reduce the path by almost 100 characters, without compromising any part of the build process.
The previous list of files now looks like this:
I hope this tip helps solve your automated build path lengths issues.