Andrew Ducker
Andrew Ducker

Reputation: 5490

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?

Upvotes: 17

Views: 5381

Answers (1)

SLaks
SLaks

Reputation: 887325

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.

Upvotes: 18

Related Questions