Why is my Visual Studio Solution (.sln) file not opening by double-clicking?

Generally, I double-click on my .sln files from Windows explorer to open the correct version of Visual Studio (I have VS 2005 and 2008 running on Windows XP).One day one of my Visual Studio 2008 solution file’s icon changed to that of the new VS 2010 icon (with blue and purple rings). And ever since when I double click it did not open VS 2008 nor my solution file. However, I open VS 2008 devenv.exe separately and do a File->Open and open my sln file. This got me on my nerve today and wanted to figure out what happened.

Many Google searches revealed that the sln file is now set to open with Visual Studio version selector and not VS 2008 itself. Hence the disappearance of the 2008 icon (with a little 9 on it). Further search revealed that if the Line formatter in the file gets corrupted somehow (could be due to your source control system – I use SVN and it indeed corrupted the file), then the VS version selector will not be able to identify the version.

If you hover over the solution file name in Windows explorer you can see that the properties tooltip shows “unrecognized version”.

So how do we fix it?

Many talk about the problem in their blogs but not how to fix it. Some suggest that just map your .sln file to VS 2008 (or 2005). But that’s only for those who use one version. For me I had to figure out something. Because I have both 2005 and 2008. So here is what I did that fixed my problem:

  1. Open VS 2008 and open your solution file using File->Open (hopefully for the last time).
  2. In the Solution Explorer right click on the Solution name and select Clean Solution.
  3. Save your solution file and close VS 2008. Notice that your icon had changed by now in Windows Explorer.
  4. Now try double clicking the file.

Hope this helps!

Comments

Anonymous said…
Many thanks for your helpful tip - this resolved my issue immediately.
Van Fanel said…
It works! Great! Thank you very much!
Abid said…
Awseome..i was having trouble and your tip worked like a charm..Thanks

Popular posts from this blog

Google Tamil Calendar

Who does the daunting task of valuing all the troubled assets?