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:
In the build server I have this is:
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)
This changes the starting path to:
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.