Show path that causes "path too long" failure

Automated deployment for web applications and databases

Show path that causes "path too long" failure

Postby isme » Thu Dec 05, 2013 8:09 pm

My deployment failed with a "path too long" error.

Code: Select all
2013-12-05 18:48:39 +00:00 INFO   Installing package ApiServices-backend-database.0.139 from uploaded package cache into G:\\Temp\\efvh0lxh.5t1\\Packages\\..\\Applications\\ApiServices DEV\\ApiServices-backend-database\\0.139
2013-12-05 18:48:40 +00:00 INFO   Installing 'ApiServices-backend-database 0.139'.
2013-12-05 18:48:40 +00:00 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.


The path in the output is only 96 characters long.

Code: Select all
G:\\Temp\\efvh0lxh.5t1\\Packages\\..\\Applications\\ApiServices DEV\\ApiServices-backend-database\\0.139


Is it one of my scripts that failing, or part of DM?

Because I don't know the problem path, I'm unsure how to proceed.

To try to work around this, I'll shorten the name of the package (ApiServices-backend-database) and the name of the environment (ApiServices DEV).

Those elements appear to be part of the problem path, so shortening them might buy me enough space.
Iain Elder, Skyscanner
isme
 
Posts: 83
Joined: Tue Jun 12, 2012 1:49 pm
Location: Edinburgh

Postby isme » Thu Dec 05, 2013 8:12 pm

While you're here, please vote for this Microsoft Connect Item to fix the problem. Apparently it's a limitation of the .NET Framework.
Iain Elder, Skyscanner
isme
 
Posts: 83
Joined: Tue Jun 12, 2012 1:49 pm
Location: Edinburgh

Postby isme » Thu Dec 05, 2013 8:32 pm

I shorted the package name to ApiBackDB, and the deployment is working normally again.

In the long run I'd like to follow our naming convention of Organization.Product.Component.

Currently deployment manager doesn't have space to support that.

I'm deploying a SQL Server package, in case that's relevant.
Iain Elder, Skyscanner
isme
 
Posts: 83
Joined: Tue Jun 12, 2012 1:49 pm
Location: Edinburgh

Postby csmith » Fri Dec 06, 2013 11:53 am

Hi

As you suggested, we think this is due to the framework's 260 char limit. The path being complained about is inside the G:\\Temp\\efvh0lxh.5t1\\Packages\\..\\Applications\\ApiServices DEV\\ApiServices-backend-database\\0.139 directory.

Your database package contains sub-folders and files from your database schema and these will have been unpackaged to that location. So if the combination of the base folder path, plus your schema name, sub-folder and object name exceeds 260 chars, then you'll get this error.

Best regards,
Chris
Chris Smith
Project Manager
SQL Lighthouse
csmith
 
Posts: 120
Joined: Thu Jun 30, 2011 2:15 pm
Location: Cambridge

Postby isme » Fri Dec 06, 2013 2:45 pm

You can follow these steps to find the problem paths.

1. Download the failing package from the TeamCity server.

2. Extract the package to your Downloads directory.

3. Navigate to the new directory in PowerShell.

Your working location should look like this:

Code: Select all
$ Get-ChildItem


    Directory: C:\\Users\\iain\\Downloads\\ApiServices-backend-database.0.139


Mode                LastWriteTime     Length Name                                                                               
----                -------------     ------ ----                                                                               
d----        06/12/2013     12:14            db                                                                                 
d----        06/12/2013     12:14            package                                                                             
d----        06/12/2013     12:14            RedGate                                                                             
d----        06/12/2013     12:14            _rels                                                                               
-----        05/12/2013     18:47        409 ApiServices-backend-database.nuspec                                                 
-----        05/12/2013     18:47        807 [Content_Types].xml                                                                 


4. Run this script to find the problem paths.

Set the value of $DeploymentManagerBasePath to the installation path of the package on the Deployment Manager server. You'll find it in the deployment log before the error message.

Code: Select all
$DeploymentManagerBasePath = 'G:\\Temp\\efvh0lxh.5t1\\Packages\\..\\Applications\\ApiServices DEV\\ApiServices-backend-database\\0.139'

Get-ChildItem -Recurse |

Resolve-Path -Relative |

% { $DeploymentManagerBasePath + $_.SubString(1) } |

? { $_.Length -gt 260 } |

% { "$($_.Length)`t$_" }


The script computes the what the full path would have been at deployment time for every file in the package.

It prints the length and full path of any files that exceed the 260-character limit.

5. Inspect the output.

For me it printed one path:

Code: Select all
280   G:\\Temp\\efvh0lxh.5t1\\Packages\\..\\Applications\\ApiServices DEV\\ApiServices-backend-database\\0.139\\db\\state\\db\\Stored%20Procedures\\BackendLayerCustomerAdministrationTests.test%20uspMaintainCustomerPermissions%20throws%20error%20when%20PermissionValue%20is%20missing%20or%20empty.sql


A whopping 280 characters!

----

The file contains a tSQLt unit test called [BackendLayerCustomerAdministrationTests].[test uspMaintainCustomerPermissions throws error when PermissionValue is missing or empty].

We can name that test more succinctly to avoid the issue.

Thanks for your help!

It would be great if you could make Deployment manager produce output like this when .NET raises the error.

Code: Select all
2013-12-05 18:48:40 +00:00 INFO   Installing 'ApiServices-backend-database 0.139'.
2013-12-05 18:48:40 +00:00 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.

The problem path was:

G:\\Temp\\efvh0lxh.5t1\\Packages\\..\\Applications\\ApiServices DEV\\ApiServices-backend-database\\0.139\\db\\state\\db\\Stored%20Procedures\\BackendLayerCustomerAdministrationTests.test%20uspMaintainCustomerPermissions%20throws%20error%20when%20PermissionValue%20is%20missing%20or%20empty.sql

Exclude the file from the release or shorten its path.
Iain Elder, Skyscanner
isme
 
Posts: 83
Joined: Tue Jun 12, 2012 1:49 pm
Location: Edinburgh


Return to Deployment Manager

Who is online

Users browsing this forum: No registered users and 0 guests