Show path that causes "path too long" failure

ismeisme Posts: 119
edited December 6, 2013 8:45AM in Deployment Manager
My deployment failed with a "path too long" error.
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.
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

Comments

  • 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
  • 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
  • csmithcsmith Posts: 138 Bronze 1
    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
    Divisional Development Lead
    Redgate Software
  • 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:
    $ 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.
    $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:
    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.
    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
  • GaryWoochGaryWooch Posts: 1 New member
    I suggest you the Long Path Tool.
  • Hi there, Nice answer! Or You could also try using LongPathTool program :-)
Sign In or Register to comment.