In Visual Studio 2010, when you try to build a solution with multiple projects where there exists dependency relationships among them, in specific conditions a build fails with the following error message.
Error Message: “C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets (1200, 9): warning: The referenced project 'Relative path to the referenced project from the current directory’ does not exist.”
A build fails with the error message above when the following conditions are met.
1. You have a solution with multiple projects where there exists dependency relationships among them. 2. The sum of the following two path length is exactly added up to 259 characters (= MAX_PATH – 1)
1) The path of a referencing project’s directory.
2) The relative path to a referenced project from the current directory (= a referencing project’s directory).
NOTE: MAX_PATH is the maximum path length defined by Windows API and is set to be 260 characters.
This issue occurs due to a bug in the Path.GetFullPath in .NET Framework library. This is a known issue in Visual Studio 2010.
If you would like to know more about Path.GetFullPath method, please refer to the document below.
.NET Framework Class Library Path.GetFullPath Method <http://msdn.microsoft.com/en-us/library/system.io.path.getfullpath.aspx>
To work around this issue, you can change path length and make sure that the sum of the following two path length is NOT added up to 259 characters.
1) The path of a referencing project’s directory. 2) The relative path to a referenced project from the current directory (= a referencing project’s directory).
We will take this issue into consideration in the next version of Visual Studio.