Once in a while when I’m working with Visual Studio, 2013 in my case, it craps our on my and starts doing weird stuff, hardly a scientific term, but I have no other words for it. Just, at random, I have no clue why or how this happens, it just happens. It not only happens to me, but also to my colleagues once in a while, so I know I’m not the only one, which means that, if you are reading this, there is a large chance you are having one of the following issues.
When starting Visual Studio …
- … by loading a solution file, no windows display and the Solution Explorer remains empty.
- … you get a bunch of error messages thrown in your face.
- … you can only add text in the editor, not remove it.
- … some other strange, unexplainable thing prevents you from using Visual Studio as you normally would.
If you are having one of the issues above and neither restarting Visual Studio or rebooting your machine helps, then there is a large change your Component Model Cache is corrupt. I don’t know the details of what exactly it is or does, and frankly, I don’t care, I just want my IDE to work as it should work. One noteworthy point though, I use the ReSharper for C# plugin extensively, I don’t know if that has anything to do with it, but I thought I’d mention it just for the record.
So, here is how you fix it:
- Close Visual Studio (if you haven’t done so already out of despair)
- Open a file explorer window and navigate toyour AppData folder. You can get there by:
- In the search bar, type %APPDATA%/.. and press enter
- Alternatively, navigate to C:\Users\\AppData
- Go into Local\Microsoft\VisualStudio\<version> where <version> is 12.0 for Visual Studio 2013.
- Delete the ComponentModelCache folder.
When you start Visual Studio now, everything is back to normal. It will automatically regenerate the files it needs in the Component Model Cache, so don’t worry about deleting any crucial data.
I hope this is useful to someone out there, it certainly saved me a real headache when I first encountered the problems.