简体   繁体   中英

What is error MSB4198: “The expression ”DirectoryName“ cannot be evaluated”

I am compiling a project in Visual Studio after I upgraded it from version 2009 to 2012. At the very final stage, I am getting an error that reads:

error MSB4198: The expression "DirectoryName" cannot be evaluated on item "..\..\..\..\..\obj\win32\vs11.0\MyProject\debug\MyProject_debug.pch". 
               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.

I tried to search for the error and it seems to be some error in the linker (potentially due to conversion from VS version (?) ), but I can't find an appropriate solution. The value of Properties | Configuration Properties | Linker | Output File in the project is $(OutDir)$(TargetName)$(TargetExt) , if that is any help.

Visual Studio is probably trying to convert a "DirectoryName", and in the process evaluated the directory path. That evaluation must have overflowed.

A common cause is trying to put your solution in My Documents . That's not as good an idea as it sounds, for precisely this reason. Microsoft has used up far too much of the allowed path length. (They really should have copied Unix; /home/username is just 14 characters.)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM