Paket icon indicating copy to clipboard operation
Paket copied to clipboard

Support for long names on Windows

Open kine opened this issue 7 months ago • 0 comments

Description

When using Paket together with nuget packages having long IDs or long file names inside it, current version (8.0.3+75b30cdcb8859e8d129f139444d9b9b600bfff07) fails when working with them. Long file names are common in our usage for packing Microsoft Dynamics 365 Business Central extensions files as nuget packages for distribution.

Repro steps

Use "Paket install" to install NuGet package with ID length 100 characters (used in my case) and file inside with length 151 chars (used in my case). Even when used root path as cache and target path, it fails.

Expected behavior

When using windows with LongPath support enabled, paket install should work with packages with long IDs and long file names inside.

Actual behavior

Version 8.0.3 output:

...
Package C:\xxx\XXXXXXXXXXXX\Paket.test\packages\XxxxxXxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.xxxxxxxxxxxxxxxxxxxxxxxx.xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.xxxxxxxxxxxxxxxxxxxxxxxxx.xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 23.1.8.1.nupkg couldn't be extracted to "C:\xxx\XXXXXXXXXXXX\Paket.test\packages\XxxxxXxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.xxxxxxxxxxxxxxxxxxxxxxxx.xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx". 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.. Trying to extract files individually.
Something went wrong while downloading xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.xxxxxxxxxxxxxxxxxxxxxxxxx.xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.23.1.8.1.nupkg 
Message: Error during extraction of C:\xxx\XXXXXXXXXXXX\Paket.test\packages\XxxxxXxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.xxxxxxxxxxxxxxxxxxxxxxxx.xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.xxxxxxxxxxxxxxxxxxxxxxxxx.xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.23.1.8.1.nupkg.
...
Paket failed with
-> Error during extraction of C:\xxx\XXXXXXXXXXXX\Paket.test\packages\XxxxxXxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.xxxxxxxxxxxxxxxxxxxxxxxx.xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.xxxxxxxxxxxxxxxxxxxxxxxxx.xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.23.1.8.1.nupkg.

    In rare cases a firewall might have blocked the download. Please look into the file and see if it contains text with further information.
-> 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.

I tried to keep the length same when masking the file name.

Known workarounds

When I cloned the code and upgraded the project to .Net core 8.0 and updated all dependencies, everything worked without problem.

kine avatar Jul 08 '24 17:07 kine