This morning when I started Visual Studio 2010 it threw a wobbly at me. It seemed the Microsoft.VisualStudio.TeamFoundation.VersionControl.HatPackage did not load correctly. Of course I tried to Google for this error but I was unable to find anything useful apart from trying to repair the Visual Studio installation. Fortunately I have the /Log option set in the shortcut so I had a logfile with the errors. Unfortunately, apart from the error that the package did not load the log contained nothing useful.
After trying a few times (hoping it would go away) there was one time where a dialog popped up with a reference to a file called VersionControl.config. Needless to say I clicked it away before I could actually read it but at least now I had a filename and a little more information.
The file is located in %UserProfile%\Local Settings\Application Data\Microsoft\Team Foundation\3.0\Cache and as Visual Studio told me, it contained nothing but garbage. As all Microsoft .config files contain XML I figured this to be the problem I deleted the file and restarted Visual Studio: problem solved!
So, if you happen to encounter the error:
The 'Microsoft.VisualStudio.TeamFoundation.VersionControl.HatPackage, Microsoft.VisualStudio.TeamFoundation.VersionControl, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' package did not load correctly.
You should check the VersionControl.config file before resorting to a Visual Studio reinstallation.