Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cannot Write To The Output File The Spcified Path/FileName Are Too Long?

Tags:

c#

filenames

I got this error in one of my projects seemingly out of no where:

Cannot write to the output file "obj\Debug 
\WindowsFormsApplication1.Properties.Resources.resources".

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.

How can I fix this?

like image 553
sooprise Avatar asked Jan 05 '11 15:01

sooprise


1 Answers

Use a shorter path, Win32 doesn't support longer paths than that. Shorter directory-names or less deeply nested hierarchies could help. The path to where you're project files are is already so long, so that when it tries to generate a file in the debug subdirectory the maximal length for paths is exceeded.

NTFS itself, the native NT APIs and the Win32 API using the \\?\ support much longer paths. But for "normal" path Win32 is limited to 260 chars for historical reasons. In particular C programs rely on the fact that a 260 char buffer can contain any path. The part of Microsoft responsible for the Win32 API is very careful not to break compatibility with older programs.

like image 143
CodesInChaos Avatar answered Sep 21 '22 19:09

CodesInChaos