TFS Error: The cache file VersionControl.config is not valid and cannot be loaded

Team Foundation Error:

The cache file C:\\Documents and Settings\\username\\Local Settings\\Application Data\\Microsoft\\Team Foundation\\3.0\\Cache\\VersionControl.config is not valid and cannot be loaded.

Please correct or delete the file.

 

Solution:

If you are working with TFS and get the above error, the possibility is the VersionControl.config file is corrupted and because of which you are not able to connect to TFS Server from Visual Studio.

I had this problem because I ran out of disk space, and my VersionControl.config file was incomplete. To get rid of the problem I had to just delete the VersionControl.config file and tried connecting to TFS from Visual Studio, it creates a new config file and everything works fine.