How can Visual Studio determine a solution file

2020-06-07 05:18发布

问题:

Think that I have two solutions: vs2009.sln and vs2010.sln. Both of solution files have the same extension (.sln) but they have different icons. And they are opened in the related version of visual studio. I wonder how does visual studio determine this?

Edit: Visual studio version selecter is ok but i wonder how can the icon be different even the extensions are same? I used to know that every extension has only one icon in registry HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\Current Version\explorer\Shell Icons

2.Edit: I found the answer finally. If anyone wonders about that, the answer is here http://msdn.microsoft.com/en-us/library/cc144122%28VS.85%29.aspx

回答1:

Open your .sln file with Notepad or another text editor. Look for Format Version on the first line which correlates with a Visual Studio version. Here's some that I'm familiar with:

  • Format Version 8.00 is Visual Studio 2003
  • Format Version 9.00 is Visual Studio 2005
  • Format Version 10.00 is Visual Studio 2008
  • Format Version 11.00 is Visual Studio 2010
  • Format Version 12.00 is Visual Studio 2013


回答2:

Solution files are text files.

The very first line contains version information.

For example, for a Visual Studio 2010 solution you will find:

Microsoft Visual Studio Solution File, Format Version 11.00

Additionally, when you have several different versions of Visual Studio installed, the .sln file goes through the Visual Studio Version Selector utility that reads this and opens the corresponding version of Visual Studio. Check the .sln file associations.



回答3:

Try opening the .sln in a notepad

the first line itself says Microsoft Visual Studio Solution File, Format Version 10.00 or 11 or whatever version it is