TeamCity DNU publish fails on path length too long

1.5k views Asked by At

My DNU publish step is failing in TeamCity due to the path length eventually getting out of control:

[14:35:29][Step 1/1] Using Package dependency Microsoft.Extensions.Configuration.FileProviderExtensions 1.0.0-rc1-final
[14:35:29][Step 1/1]     Source C:\Users\TFSSERVICE\.dnx\packages\Microsoft.Extensions.Configuration.FileProviderExtensions\1.0.0-rc1-final
[14:35:29][Step 1/1]     Target D:\TeamCity\buildAgent\work\31745f64510dfced\artifacts\Company.Auth.IdentityProvider\approot\packages\Microsoft.Extensions.Configuration.FileProviderExtensions\1.0.0-rc1-final
[14:35:29][Step 1/1] Using Package dependency Microsoft.Extensions.FileSystemGlobbing 1.0.0-rc1-final
[14:35:29][Step 1/1]     Source C:\Users\TFSSERVICE\.dnx\packages\Microsoft.Extensions.FileSystemGlobbing\1.0.0-rc1-final
[14:35:29][Step 1/1]     Target D:\TeamCity\buildAgent\work\31745f64510dfced\artifacts\Company.Auth.IdentityProvider\approot\packages\Microsoft.Extensions.FileSystemGlobbing\1.0.0-rc1-final
[14:35:29][Step 1/1] Error: 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.
[14:35:29][Step 1/1] Process exited with code 1
[14:35:29][Step 1/1] Step DNU publish (Command Line) failed

I have already updated my checkout rules agent path to root the project closer to the build agent directory.

A possible solution could be to set the publish output to be something closer to the drive root. However, the TeamCity DNU publish build step does not support changing the output directory. Additionally, I would then be responsible for managing this directory.

An ideal solution would involve the least amount of manual configuration to the build agent, as I have several of them.

3

There are 3 answers

2
Victor Hurdugaci On BEST ANSWER

We (the ASP.NET team) use TeamCity and hit the path limit on Windows. Unfortunately, this was caused by a node.js path and we cannot control it so we had to move the work directory closer to the drive's root. Right now is in D:\ba (ba = build agent).

So, the only solution that I have for you right now is to try to get the project closer to the drive's root.

The DNU publish command appears to operate correctly on Windows 10, but not any prior Windows version, including Server 2012 R2. As of now, I can only suspect warlock black magic (converting to NT paths and back?)

dnu should work on Win 7 (with the latest SP), Win 2008 R2, Win 8, Win 2012, Win 10, and Win 2016 Server. If you hit any issues with a particular platform, open a bug on Github (aspnet)

0
James Reed On

A possible solution is to modify the Team City build agent config to use a shorter path for the working folder. i.e. change

D:\TeamCity\buildAgent\work

To something like

D:\work

or even

D:\w

0
Lukasz Pyrzyk On

You can share folder with special, short name.

Also here you can find similar question with few answers.