Visual Studio gone bonkers: 'The directory name is invalid' error when trying to compile
Solved! Thanks for the input, I meanwhile found a solution. The cause is rare, but it may happen to others, so I decided to answer my own question here:
Cause
An incorrect or inaccessible %TEMP%
location, or an inaccessible %USERPROFILE%
path.
I had moved these paths to a faster SSD drive to speed up compiling. The drive crashed and the OS did not find it anymore (as reported on ServerFault here) and consequently, the moved locations (internet caches, my documents and temp) had become inaccessible.
The error mentioned by Visual Studio is misleading: it has nothing to do with the name of the file (while I'm still wondering why it was querying the executable as a directory), the error was about the %TEMP% location being bad.
Solution
Fix the %USERPROFILE%
or %TEMP%
environment variables, (in case you forgot, it's here: System > Advanced > Environment Variables).
Note: The typical and default TEMP setting is to use the USERPROFILE environment variable as in the default %USERPROFILE%\AppData\Local\Temp
. This works, but only if in the registry, the key under HKCU\Environment\TEMP
is of the type REG_EXPAND_SZ
and not REG_SZ
.