question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Paket fails to install nugets with paths longer than MAX_PATH

See original GitHub issue

Description

paket restore fails with PathTooLong when installing the package runtime.opensuse.13.2-x64.runtime.native.System.Security.Cryptography.OpenSsl. This package is included by NETStandard.Library package

This bug seems to have been addressed in #949 but this seems another use case that is not handled correctly.

Repro steps

  1. Create an empty project in a directory path long enough eg: C:\longomatch-build_windows_windows_x86\sources\windows_x86\lm-protected-git-master\

  2. Create a packet.dependencies with the package NETStandard.Library

  3. Run paket install

Expected behavior

The command detects that the path is too long and shortens the package ID

Actual behavior

The command fails with PathTooLong

Known workarounds

None

Logs

` Paket version 5.113.1 paket.local override: nuget Couchbase.Lite.LM group Main -> /vas-nightly_windows_windows_x86/dist/windows_x86/share/nuget paket.local override: nuget Couchbase.Lite.Storage.SystemSQLite.LM group Main -> /vas-nightly_windows_windows_x86/dist/windows_x86/share/nuget paket.local override: nuget Sparkle group Main -> /vas-nightly_windows_windows_x86/dist/windows_x86/share/nuget paket.local override: nuget WebKit group Main -> /vas-nightly_windows_windows_x86/dist/windows_x86/share/nuget paket.local override: nuget Wibu group Main -> /vas-nightly_windows_windows_x86/dist/windows_x86/share/nuget paket.local override: nuget EPPlus.LM group Main -> /vas-nightly_windows_windows_x86/dist/windows_x86/share/nuget Something went wrong while downloading runtime.opensuse.13.2-x64.runtime.native.System.Security.Cryptography.OpenSsl 4.3.1 Message: Path too long: z:\longomatch-build_windows_windows_x86\sources\windows_x86\lm-protected-git-master\packages\runtime.opensuse.13.2-x64.runtime.native.System.Security.Cryptography.OpenSsl\runtime.opensuse.13.2-x64.runtime.native.system.security.cryptography.openssl.4.3.1.nupkg ==> Trying again Something went wrong while downloading runtime.opensuse.42.1-x64.runtime.native.System.Security.Cryptography.OpenSsl 4.3.1 Message: Path too long: z:\longomatch-build_windows_windows_x86\sources\windows_x86\lm-protected-git-master\packages\runtime.opensuse.42.1-x64.runtime.native.System.Security.Cryptography.OpenSsl\runtime.opensuse.42.1-x64.runtime.native.system.security.cryptography.openssl.4.3.1.nupkg ==> Trying again Downloading runtime.opensuse.13.2-x64.runtime.native.System.Security.Cryptography.OpenSsl 4.3.1 Downloading runtime.opensuse.42.1-x64.runtime.native.System.Security.Cryptography.OpenSsl 4.3.1 Something went wrong while downloading runtime.opensuse.42.1-x64.runtime.native.System.Security.Cryptography.OpenSsl 4.3.1 Message: Path too long: z:\longomatch-build_windows_windows_x86\sources\windows_x86\lm-protected-git-master\packages\runtime.opensuse.42.1-x64.runtime.native.System.Security.Cryptography.OpenSsl\runtime.opensuse.42.1-x64.runtime.native.system.security.cryptography.openssl.4.3.1.nupkg ==> Last trial Downloading runtime.opensuse.42.1-x64.runtime.native.System.Security.Cryptography.OpenSsl 4.3.1 Something went wrong while downloading runtime.opensuse.13.2-x64.runtime.native.System.Security.Cryptography.OpenSsl 4.3.1 Message: Path too long: z:\longomatch-build_windows_windows_x86\sources\windows_x86\lm-protected-git-master\packages\runtime.opensuse.13.2-x64.runtime.native.System.Security.Cryptography.OpenSsl\runtime.opensuse.13.2-x64.runtime.native.system.security.cryptography.openssl.4.3.1.nupkg ==> Last trial Downloading runtime.opensuse.13.2-x64.runtime.native.System.Security.Cryptography.OpenSsl 4.3.1 Performance:

  • Disk IO: 1 minute, 52 seconds
  • Average Download Time: 560 milliseconds
  • Number of downloads: 4
  • Average Request Time: 901 milliseconds
  • Number of Requests: 4
  • Runtime: 33 seconds Paket failed with -> PathTooLongException: Path too long: z:\longomatch-build_windows_windows_x86\sources\windows_x86\lm-protected-git-master\packages\runtime.opensuse.13.2-x64.runtime.native.System.Security.Cryptography.OpenSsl\runtime.opensuse.13.2-x64.runtime.native.system.security.cryptography.openssl.4.3.1.nupkg -> PathTooLongException: Path too long: z:\longomatch-build_windows_windows_x86\sources\windows_x86\lm-protected-git-master\packages\runtime.opensuse.13.2-x64.runtime.native.System.Security.Cryptography.OpenSsl\runtime.opensuse.13.2-x64.runtime.native.system.security.cryptography.openssl.4.3.1.nupkg -> 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. make[3]: *** [restore] Error 1 `

Issue Analytics

  • State:open
  • Created 6 years ago
  • Reactions:3
  • Comments:13 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
sgalloucommented, Mar 27, 2019

Is this problem related to the .NET framework used ? In this case, using .NET framework version >= 4.6.2 should solve this, as MAX_PATH limitation seems to be finally fixed.

0reactions
NightWatchmancommented, Nov 10, 2021

Thanks for the advice! I’m targeting .NET 5, soon to be .NET 6, with no odd custom references, so this worked just fine for me.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Nuget install faill because of a path which is to long
EntityFrameworkCore package but when I try to install, it fails because of a long path/repertory name. This path is supposed to be shorter ......
Read more >
Long Path Support (NuGet CLI)
In this article ... NuGet.exe 4.8 and later support long paths for files and directories for scenarios like Pack, Restore, Install, and most...
Read more >
ZetaLongPaths 1.0.17
This is a library that provides several classes and functions to perform basic operations on file paths and folder paths that are longer...
Read more >
Nuget installation on max_path causes packages to be ...
I'm using LINQPad 5.05.02 I had the nuget package Microsoft. ... However, trying to install it hit Windows' 260 path limit (MAX_PATH).
Read more >
Installation error codes and solutions
Error code Error message logged Reason DF001 Unable to get permissions of . Cannot get file/folder permission. DF002 Unable to restore permissions of to 04o....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found