TFS Build error - "The specified path, file name, or both are too long..."
Asked Answered
X

2

6

I'm writing the Custom Activities of build process template. I got the below issue when build the activity.

>XamlBuildTask : error XC1043: Extension 'Microsoft.Activities.Build.BeforeInitializeComponentExtension' threw an exception of type 'System.IO.PathTooLongException' :  'The specified path, file name, or both are too long. The fully qualified file name must be less than 260 characters, and the directory name must be less than 248 characters.'.

Do you have any ideas? Please help!

Xerophthalmia answered 20/1, 2014 at 4:2 Comment(0)
S
4

I find one tip here. Hope it might be helpful to you.

Currently there are a two workarounds:

Reduce the namespace in workflow x:Class property. This makes the generated file have a shorter name.

Use the subst or mklink command to create mapping so that the path the solution is located in becomes a lot smaller. In team build, the workspace mapping needs to be modified equally.

Saponin answered 20/1, 2014 at 4:24 Comment(1)
My build steps stored files in a directory "artifacts" and my publish step published this directory under a different name. It appears that, by coincidence, the TFS agent used a default name "artifacts" as the publish destination. This way or the other, my "artifacts" directory grew recursively with each build until I got the error about exceeding the maximum path length.Acquit
D
1

This still happens in 2015 TFS

This is the best answer I got changing build agent properties Properties to save path space

  1. The build agent properties dialog defines the "Working directory” for the build agent, defaulting to “$(SystemDrive)\Builds\$(BuildAgentId)\$(BuildDefinitionPath)”. Based on the above link, I’m going to go with “$(SystemDrive)\B\$(BuildDefinitionId)” – that should take the '”uilds” off the base directory, the TFS project name (19 characters), a backslash, and the build name (7 characters) out, and replace them with just a 32-bit number (which should be at most 10 digits, but since it starts from 1, it’s much more likely to be 3-4 digits), saving me 23 characters minimum
  2. I may not have been able to shorten $(SourceDir), but it’s just “$(BuildDir)\Sources”, right? I can just configure the build to pull the code to “$(BuildDir)\S” instead of “$(SourceDir)”, and I should save another 6 characters, getting me to 29 characters saved, which should be enough
Demb answered 19/11, 2015 at 13:41 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.