"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.
Published Wednesday, June 22, 2005 11:37 AM by RoyOsherove
Filed under:

Comments

Thursday, June 23, 2005 11:47 PM by Mikhail Arkhipov (MSFT)

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

Actually, I don't think this is System.IO limitation. It is general OS limitation which has been around since forever :-) MAX_PATH is declared as 260 characters in windows.h.
Saturday, June 25, 2005 5:40 PM by Roy Osherove

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

Would have been nice if VS.NET *told* me that that was the problem though, wouldn't it?
Friday, June 23, 2006 11:57 AM by Anne Hanson

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

I had this same problem with a corrupted .Net compiler using VS.NET 2002 and the 1.0 framework. I downloaded and reinstalled the SDK 1.0a and it fixed the problem immediately. Remember to reboot.