We received the above error for the resx file of a form in our project today. So we checked the existence of the resx file it concerned, and it was there. So maybe the file was corrupt? We deleted the file, removed it from the project and let Visual Studio re-create it by editing the form in the designer. Building the solution gave the same error… again the file was right where it was supposed to be.

Next we deleted the file and then built the solution: this worked! But why? And would it still work when we edited the form in the VS designer? The answer to that last question is: nope. As soon as the file was created by the designer the build error popped up again.

Searching MSDN Library did give me this topic, but that doesn’t give a satisfying answer because it only describes the error. So, I ‘Google grouped’ it.  Eventually, this lead me to this post. In short it says:

The limit to project names (including their fully qualified path) in VS.NET is 258 characters. (…) I suspect, however, that you are running into a name length issue. The 258  character limit on the length of path names is something we’ve received feedback on before (…). As a result, we are looking into this problem for fixing in the future.



Allen (VS Core Team)

I tested some stuff and found out that building a solution which is in a 218 character directory structure and includes a form called ‘form1’ builds ok in debug configuration, but not in release configuration. Shortening the directory structure with one character solves the problem there. Form1.resx counts 10 characters. Add this to the 217 we had for the directory and you get 227. So that might be the magic number.  But that doesn’t explain why building debug works, while building release doesn’t. Of course, release is a longer word than debug, but the error occurs on the resx file in the application root which is not influenced by the configuration of the build you are making. Maybe VS creates temporary files and these break the build process?

Anyway: keep away from 200+ directory structures (and ridiculously long filenames) and you will be fine…