Udostępnij za pośrednictwem


Warning CS1668: Invalid search path...

We once again saw a few reports of folks running into the CS1668 warning every time they used the C# compiler when we released Beta 2. For those who use the /warnaserror+ compiler option, it blocks compilation as it gets promoted to an error.

To some users, this diagnostic comes as a surprise. We added it very early in the Whidbey (C# 2.0/VS 8.0) product cycle to help those who made a simple typo when modifying their LIB environment variable (or when using the /lib compiler option) but it's still a new thing to deal with for those trying out Whidbey for the first time. Tons of customers have yet to try Whidbey and their first experience with it will be with the final released version. So, I'm sure there will be some more who hit this in the future.

The unfortunate thing about this is that we've realized that uninstalling Visual Studio 2002 (v7.0) or Visual Studio 2003 (v7.1) will remove certain directories that were added to the LIB environment variable at install time. This leaves your LIB environment variable in a state that will cause the Whidbey compiler to warn you about it using the CS1668 diagnostic. Plenty of developers are familiar with environment variables in Windows and it shouldn't cost them more than a few seconds to get rid of the warning forever, but I've run into a few who weren't as familiar with it and it caused them some grief. The good news is that Whidbey no longer seems to modify these environment variables at install time, so we shouldn't run into a similar situation with future releases.

The warning looks as follows:
warning CS1668: Invalid search path 'foo' specified in 'LIB environment variable' -- 'The system cannot find the path specified.'

To fix this, one must remove the path that no longer exists on the machine from the LIB environment variable. Here are a couple of links to some online Windows documentation that cover the specifics for making these changes:

Comments