Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Visual Studio unknown build error. The fully qualified name must be less than 260 characters

I'm having trouble while building my WPF solution. Everytime I try to build it, I get this error message:

Unknown build 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.'

Someone can help me? I've already verified all the fields and their extension paths are ok. Can this be a problem with the TortoiseSVN or something like this? I recently added a folder to my solution, can be something with this?

like image 310
user1517951 Avatar asked Jul 11 '12 13:07

user1517951


3 Answers

This is a well-known restriction in the Windows win32 api. The directory in which you stored your project is nested too deep. The full path name of a file cannot contain more than 259 characters. Beyond this, lots of C code that uses MAX_PATH starts failing due to buffer overflows.

Move your solution to another directory, one that's closer to the root.

like image 89
Hans Passant Avatar answered Oct 18 '22 12:10

Hans Passant


I had a similar issue where the compiler reported that there was a problem with the file ASPNETCOMPILER. The actual issue was that the solution contained a node_modules folder, and this folder can contain very lengthy paths, and it looks like the compiler can't handle this.

Windows 8.1 and 10 have an option to increase the Win32 path limit:

  • Open Group Policy Editor (Press Windows+R and type gpedit.msc and hit Enter)
  • From the Group Policy Editor window, navigate to the following node: Local Computer Policy\Computer Configuration\Administrative Templates\System\Filesystem
  • Doubleclick on Enable Win32 long paths option and enable it.

This may allow you to temporarily move the problem folder out of the build, which may allow you to successfully build, then you may be able to add the folder back into the solution without affecting anything.

See here for additional reference - https://www.microfocus.com/documentation/filr/filr-4/filr-desktop/t47bx2ogpfz7.html

like image 30
Chris Halcrow Avatar answered Oct 18 '22 12:10

Chris Halcrow


There is registry approach which can be used at least for Windows 10:
Value of the parameter HKLM\SYSTEM\CurrentControlSet\Control\FileSystem LongPathsEnabled (Type: REG_DWORD) should be set to 1. enter image description here You don't even need top restart anything (IDE or PC).

like image 16
SerjG Avatar answered Oct 18 '22 10:10

SerjG