Thursday, April 15, 2010

Fixing “Invalid search path” for LIB environment variable in MSBuild

Problem: Trying to run msbuild.exe against a .sln file results in a failed build with an error message containing the error

error CS1668 : Warning as error : Invalid search path 'C:\Program Files\Microsoft SDKs\Windows\v6.0A\lib'
specified in 'LIB environment variable' -- 'The system cannot find the path specified. '

Examining the path C:\Program Files\Microsoft SDKs\Windows\v6.0A shows no \lib folder present.

Solution: Simply add an empty \lib folder. MSBuild doesn’t actually need anything in the SDKs folder for most builds; however, the vsvars32.bat file sets that directory as the LIB environment variable anyway.

This hacky fix has worked for me on a number of different systems and I’ve yet to run across any real issues. I’m blogging it here so I’ll remember next time without having to spend too much time searching…


joemorel said...

Thanks for leaving this online Jim...I was trying to build this morning from the cmd line and just ran into this. :)


Anonymous said...

Made my day, thx!

Anonymous said...

you're the best! thanks a lot for this hack.

Subscribe (RSS)

The Leadership Journey