Roy Osherove

View Original

"Visual C# .NET compiler could not be created" - Possible solution?

We started getting this weird exception when trying to build some solution manually:
"Project <Name> could not be opened because the Microsoft Visual C# .NET compiler could not be created"
 
It might be one of these things here, but for me it was something different.
 
The path of  one of the project files inside the solution was just too long.
How long? With System.IO it seems impossible to access any files or directories if the
total name (.FullName) is longer than 260 characters or else you get a "PathTooLongException".
 
Of course - VS.NET 2003 was not polite enough to reveal that information to me. No. I had to find out through a mistress - Resharper. This wonderful add in popped up with a dialog box explaining there was an error in loading the project data:
 
JetBrains.ReSharper.Util.InternalErrorException: An exception has occurred during initialization of a solution component ---> System.IO.PathTooLongException: The path is too long after being fully qualified.  Make sure path is less than 260 characters.
 
Thanks, JetBrains.