Nuget installation on max_path causes packages to be removed

edited May 2016
I'm using LINQPad 5.05.02

I had the nuget package Microsoft.IdentityModel.Clients.ActiveDirectory installed previously.

LINQPad NuGet Manager showed that there was an update for this package. However, trying to install it hit Windows' 260 path limit (MAX_PATH).

The LINQPad error message shown is:
Error downloading 'Microsoft.IdentityModel.Clients.ActiveDirectory' - 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.

Additional warnings: Install failed. Rolling back...

However, it did not roll back the update, it uninstalled the package entirely. I get the same error trying to install it again.

The path it was trying to install to was not particularly long. The final status bar message before the message box appeared was:
Adding package 'Microsoft.IdentityModel.Clients.ActiveDirectory' to folder 'C:\Users\<user name>\AppData\Local\LINQPad\NuGet.FW46\Microsoft.IdentityModel.Clients.ActiveDirectory'

Where my <user name> is 13 characters long.

The version of the package that I was trying to install is 2.26.305102204


  • edited May 2016
    The most recent version of the package that still installs successfully (with "add specific version to query") is 2.24.304111323

    When loading a query that uses a nuget package, the specific version option is not available, so the query needs to be loaded without downloading the nuget package, then the nuget package removed and the specific version re-added.
  • I think I'll need to try and find a way to avoid unpacking the files entirely.

    In the meantime, download the latest beta and change the NuGet package folder in NuGet | Settings. Change it to something short like c:\temp and you should be fine.
  • edited May 2016
    Thanks, I'll give it a go!

    Edit: That worked.
  • If anyone else has this problem, when changing nuget directories it is useful to copy the contents of the existing directory to the new one.

    This will copy any automatic namespace imports which have been set (by the "add selected namespaces in future without tasking" button)
  • I would like to suggest you, try LongPathTool program to resolve this issue.
    This tool is very helpful to resolve the issue.
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!