Monday, 18 January 2016

Nuget-Install-Package : The specified path, file name, or both are too long

Problem:

Today, I have downloaded a graph api sample project from Microsoft site, then opened the project solution from Downloads folder, now I am receiving the build error 'The specified path, file name, or both are too long. The fully qualified file name must be less than 260 characters'.

Then I have tried to download the file 'Microsoft.IdentityModel.Clients.ActiveDirectory.dll' by using Package Manager Console. But I got the same error.
PM> Install-Package Microsoft.IdentityModel.Clients.ActiveDirectory -Version 1.0.3
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:16
+ Install-Package <<<<  Microsoft.IdentityModel.Clients.ActiveDirectory -Version 1.0.3
    + CategoryInfo          : NotSpecified: (:) [Install-Package], PathTooLongException
    + FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PowerShell.Commands.InstallPackageCommand

Solution:

After analyzed some time, find my project path is long enough that when the package is installed, adding the package folder fails because it reached the qualified name length limit.

My actual project path:

C:\Users\Administrator\Downloads\grapghapi-active-directory-dotnet-webapi-onbehalfof\active-directory-dotnet-webapi-onbehalfof-master
The above path is too long and it reached the qualified name length limit. So, I have renamed the project folder name and moved project folder from Downloads folder to C Drive.

My new project path:

C:\graph-api-sample
Now, the too long path problem solved for me.

Advertisements
Advertisements

1 comment:

  1. You could use third party software to bypass long path errors. I suggest Long Path Tool. Try it now and thank me later

    ReplyDelete