Solved: “Value does not fall within the expected range” error when opening app.config or web.config in Visual Studio 2012

I recently started getting the follow error in Visual Studio 2012 when I tried to open any configuration file:

Error: Value does not fall within the expected range

It took a bit of working out, but the solution for me was as follows:

  • Close Visual Studio
  • Browse to the top level folder where the solution is located in Windows Explorer
  • Search for and delete files matching the following two patterns: *.user, *.suo
  • Restart Visual Studio

That should do the trick.