Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How does Windows know what version of Visual Studio a .sln file relates to?

If I have a VS 2005 solution then it shows up as "Version: Visual Studio 2005". If I have a VS 2010 solution, the sln file shows up as related to that.

Both of them have a .sln suffix. So how does Windows know which version of VS to open it with?

like image 554
Andrew Ducker Avatar asked Jan 14 '11 16:01

Andrew Ducker


People also ask

What is the purpose of the * .sln file in Visual Studio projects?

SLN extension represents a Visual Studio solution file that keeps information about the organization of projects in a solution file. The contents of such a solution file are written in plain text inside the file and can be observed/edited by opening the file in any text editor.

How do I know which version of Visual Studio project I have?

Open up the . sln file in a text editor such as notepad. The version should be in the first few lines following a "#" symbol. Show activity on this post.

What does .sln file contain?

sln file. The . sln file contains text-based information the environment uses to find and load the name-value parameters for the persisted data and the project VSPackages it references. When a user opens a solution, the environment cycles through the preSolution , Project , and postSolution information in the .

How do I open a sln file without Visual Studio?

Solution 1 Basically a solution file can be opened by using appropriate IDE (development enviornment) For Example you need visual studio to open . net related sln file. You can also use NOTEPAD to just open and read the content of sln file.


1 Answers

It uses Property Handler and Icon Handler shell extensions (part of the Visual Studio Version Selector)
These are registered by the registry key HKEY_CLASSES_ROOT\VisualStudio.Launcher.sln (referenced by HKEY_CLASSES_ROOT\.sln)

When you open the file, it runs "c:\Program Files (x86)\Common Files\Microsoft Shared\MSEnv\VSLauncher.exe" "%1", which reads the version from the .sln file and open the correct version.

like image 173
SLaks Avatar answered Sep 26 '22 00:09

SLaks