-
Notifications
You must be signed in to change notification settings - Fork 252
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
NuGet and long file name support #3324
Comments
We do not yet support long paths in NuGet. |
@rrelyea, why did you drop the |
@rrelyea since Jenkins Branch Pipeline creates horribly long sln root folder names (and they aren't willing/capable to change that, so I can't shorten the path anymore. Is there a another workaround? Will this be addressed in 3.* or in 4? |
We don't know the exact timeline when we'd be able to do this work. We know if won't fit into NuGet 4.0.0 |
@nerumo You can try to shorten path with environment variables. |
Bug 389573:[Feedback] Nuget restore fails because path too long |
Any update on this? |
Any updates? It's a critical issue for us because we still have to use NuGet 2.x for some features; it's impossible to migrate to NuGet 4.x because of the lack of the long file name support. |
We tried applying the long file paths GPO to work around this but it was a fail. https://www.saotn.org/wp-content/uploads/2016/10/GPO_Enable_Win32_long_paths_2.png |
I am suggesting "Long Path Tool" program that solves path too long issues with simplicity. |
Any updates? |
It is the very painful issue if you restore packages into AppData folder and you have a long username. Some package couldn't be restored. :( |
I'm using core DLLs from nuget for processing packages, and I cannot move to v4 APIs because of this problem. |
You can shorten with subst program. |
Please fix this issue, not able to proceed with build because of this issue |
[edit] removed my comment because nuget restore produces a correct error message. I used visual studios nuget restore which doesn't ... |
I've recently installed Visual Studio 2022 (which uses NuGet 6.0) but the issue still isn't fully solved yet. NuGet related tools that support long paths out of the box
NuGet related tools that support long paths after setting the
NuGet tools that do not support long paths on Windows at all (no matter the registry setting)
As a workaround I have set the registry key value to 1 and use |
As per the Windows team's docs on supporting long path:
The docs also show the XML that needs to be in the manifest for the operating system to allow the process to use long paths. If you look at As I wrote in my previous comment in this thread, NuGet works on all the command line tools, and the docs I linked here show why it doesn't work in Visual Studio. There's a Visual Studio Developer Community request for this feature, but it has fewer upvotes than this github issue 😞. So, my best suggestion is that giving feedback directly to Visual Studio has a higher probability of influencing change than here to the NuGet team. The process/executable owner has to modify the file to include |
FWIW, I tried editing my machine's |
Still no news on this? We've been reducing our path names as much as possible as a work-around, but this really needs to get fixed! No reason for this to remain open since 2016 |
@dylanbobb did you not read my comment directly above yours? NuGet does support long paths (with nuget.exe, dotnet.exe, msbuild.exe), but Visual Studio (devenv.exe) does not. |
If the issue really isn't with nuget that's good news! This issue should be closed in that case. |
Although the original request for this issue was about the NuGet SDK, not tooling like msbuild, Visual Studio, nuget.exe, the generic title appears to have caused a number of people to comment on Visual Studio in particular. Therefore, I created a new issue with a more specific title, to gather upvotes: Similar to how MSBuild's "support long paths" issue was closed back in 2019 with the justification that they've done everything in their control to support long paths, and explaining the caveat that just because MSBuild supports long paths doesn't mean that Visual Studio (devenv.exe) does, I'm going to close this for the same reason. What changedBack in 2018, nuget.exe was changed to support long path: NuGet/NuGet.Client#2247 For everything else (Visual Studio, MSBuild, other apps using the NuGet SDK), it depends if their executable opts in to Windows' long path support. Refer to Windows' documentation on the long path limitation, and pay special attention to the Known issuesAt the time of writing, Visual Studio (devenv.exe) does not opt into long path support. Therefore, restoring or installing packages in Visual Studio where file names are over 260 characters will not work. There is a Visual Studio Developer Community request to support long paths, which you can upvote: https://developercommunity.visualstudio.com/t/Allow-building-running-and-debugging-a/351628 |
@zivkan I don't think the fix merged back in 2018 actually does anything. Yes, enabling long path support in the registry seems to fix the NuGet cli but the script as currently checked in does nothing... Check out line 159 and the -not. That reg key exists and therefore Test-Path returns true... `$regKeyFileSystem = "HKLM:SYSTEM\CurrentControlSet\Control\FileSystem" if (-not (Test-Path $regKeyFileSystem)) |
@senstar-nross that script is run on NuGet's CI and used to configure the build agent. In other words that script runs on the machine that builds the binaries that we all run on our own machines. The script has nothing to do with the execution of the binaries once built. As per Windows' documentation, if you have the registry/group policy setting enabled, then any .exe whose application manifest (an xml file embedded inside the Visual Studio (devenv.exe) does not have the application manifest setting. If you hack the exe, NuGet will successfully extract packages to paths greater than 260 characters, but there are many scenarios/features that will cause VS to crash or fail in other unexpected ways, so this is a very unsupported state that I do not recommend. |
@zivkan sorry, yes I realized that after I wrote the comment. The script is still wrong though :) |
I often have the following exception during restore on Windows:
In the NuGet 2.x API, there is a nice interface
IFileSystem
. So, I could implement own file system which supports long paths. In the NuGet 3.x API,IFileSystem
is legacy; the core logic works with the file system directly viaSystem.IO
(see an example).Is there a workaround which adds the long paths support in NuGet 3.x?
The text was updated successfully, but these errors were encountered: