Visual Studio 2010 – Failing project reference

I just ran into a bug with project references not being found in Visual Studio 2010 if the paths of the source and referenced projects are a certain length.

Visual Studio 2010 fails to build the project when the following occurs:

  1. The sum of the following two items exactly 259 characters
    1. The referencing project’s directory path
    2. The relative path to a referenced project from the directory in A

This appears to be due to a bug in Path.GetFullPath in the .NET Framework. More information can be found at http://support.microsoft.com/kb/2516078