Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Nuget package manager long file name error

When I install nuget packages with long file names I get following error: 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. Also it seems when project path is long we get this error beacause specified path is long in this case.

Is there any solution to solve this problem so that I be able to install nuget packages with long file names?

like image 714
Ali Dehghani Avatar asked Sep 11 '17 07:09

Ali Dehghani


1 Answers

Is there any solution to solve this problem so that I be able to install nuget packages with long file names?

The easiest way to avoid this issue is to move your source to the C:/ drive (or another location with fewer characters in the path) or install the long path tool.

Besides, you can create nuget.config and store it in the same location as your solution file:

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <config>
    <add key="repositoryPath" value="C:\MyPackagesFolder" />
  </config>
</configuration>

This would change the default packages folder for the configuration level you put the file in. Obviously you can put whatever path you want.

See Configuring NuGet behavior for more information.

Hope that helps

like image 108
Leo Liu-MSFT Avatar answered Oct 26 '22 01:10

Leo Liu-MSFT