Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I troubleshoot the installation of this Nuget package?

Tags:

I am trying to install the EnterpriseLibrary for Transient Fault Handling. This is a Microsoft package. When i try to install it I am getting the following error :

Install failed. Rolling back...
Install-Package : The specified path, file name, or both are too long. The fully qualified file name must be less than 260 char
acters, and the directory name must be less than 248 characters.
At line:1 char:16
+ Install-Package <<<<  EnterpriseLibrary.WindowsAzure.TransientFaultHandling
    + CategoryInfo          : NotSpecified: (:) [Install-Package], PathTooLongException
    + FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PowerShell.Commands.InstallPackageCommand

I have tried selecting the package from the Nuget ui. I have tried manually installing the package using the Nuget command line.

I have tried manually installing the dependencies one by one. It fails on the same package every time.

My project location is the default MyDocuments/visualstudio/projects location.

Any ideas ?

like image 529
BentOnCoding Avatar asked Mar 12 '12 17:03

BentOnCoding


People also ask

How do I force a NuGet package to Install?

Switch to the Browse tab, search for the package name, select it, then select Install). For all packages, delete the package folder, then run nuget install . For a single package, delete the package folder and use nuget install <id> to reinstall the same one.

How do I fix a missing NuGet package?

Enable package restore by choosing Tools > Options > NuGet Package Manager. Under Package Restore options, select Allow NuGet to download missing packages. In Solution Explorer, right click the solution and select Restore NuGet Packages.


3 Answers

It looks like your project path is long enough that when the package is installed, adding the package folder fails because it reached the qualified name length limit.

I mean : [drive]:\Users[user]\Documents\Visual Studio 2010\Projects[yourproject]\packages\ + \EnterpriseLibrary.WindowsAzure.TransientFaultHandling\ has more than the limit.

Can you move you project somewhere else ?

like image 193
Alexandre Dion Avatar answered Nov 24 '22 07:11

Alexandre Dion


In addition to Alexandre's answer:

You can use the subst command to keep your path shorter. For example I had a similar problem and used

subst P: "C:\Users\[username]\Documents\Visual Studio [year]\Projects"

to create a new P: drive (p for projects) and shorten the length of the path by many characters. Make sure that you open the solution by navigating to the solution under P: not C:\Users\Docs..., and you might want to delete any shortcuts (particularly recently opened projects) to the solutions under C:.

You can also create a batch file that contains this and put it in Start Menu/Startup (or C:\Users\[username]\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup) which will run it every time that you start your computer and mean that you always have a P: drive.

like image 34
Jonny Avatar answered Nov 24 '22 08:11

Jonny


I have also got the same error but it got easily resolved , when i moved my package to one upper level drive , or u can probably keep your project inside one folder in

it will surely work rather than giving a lengthy path

drive:\[folder1]\Documents\Visual Studio 2010[folder2][projectname]\ .. \

which exceeds the limit of 248 characters

like image 23
ashishraaj Avatar answered Nov 24 '22 08:11

ashishraaj