NuGet/Home

Install-Package gives error with 260 character path length, even with LongPathsEnabled enabled.

whitneyland opened this issue · 1 comments

Install-Package gives an error that fully qualified paths must be less than 260 characters, even with then LongPathsEnabled registry key is set.

NuGet product used: Package manager console within Visual Studio
NuGet version: 4.4.0
.NET Framework version: 4.71 (C# console application)
VS version: 15.4.4 (Visual Studio 2017 community edition)
OS version: Win10 10.0.15063

Detailed repro steps so we can see the same problem

  1. Load this sample project into VS2017:
    https://github.com/OfficeDev/Project-CSOM-Read-Enterprise-CustomFields

  2. From the package manager console:
    Install-Package Microsoft.SharePointOnline.CSOM -Version 16.1.6906.1200

  3. The error is displayed:
    Install-Package : 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.
    At line:1 char:1
    + Install-Package Microsoft.SharePointOnline.CSOM -Version 16.1.6906.12 ...
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo : NotSpecified: (:) [Install-Package], Exception
    + FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PackageManagement.PowerShellCmdlets.InstallPackageCommand

The full path of the project is 118 characters to the project root with the .sln file. It's 160 characters to the folder with the .csproj file.
C:\Users...\Project-CSOM-Read-Enterprise-CustomFields-master\Project-CSOM-Read-Enterprise-CustomFields

Other suggested things

After setting this registry key a full reboot was performed before getting the error:
HKLM\SYSTEM\CurrentControlSet\Control\FileSystem\LongPathsEnabled = 1

Sample Project

https://github.com/OfficeDev/Project-CSOM-Read-Enterprise-CustomFields

Duplicate of #3324