Why double-clicking on an .SLN file doesn’t always launch Visual Studio

Andrew Arnott

Well this is my first post as a member of the Visual Studio Platform & Ecosystem team.  My second full day on the job, and I’ve found some less-than-ideal areas of Visual Studio that I’m eager to improve for myself and for you, our customers.  How exciting.  I’ll do my best to post to my blog whenever I run across some unexpected scenario that is likely to hit customers and how to work around it.

So on to the first scenario…

Scenario

You have Visual Studio 2008 installed, but some Visual Studio Solution files (.sln) don’t open when you double-click on them.  In fact, nothing happens.

Analysis

When you double-click on a .sln file, a small program called vslauncher.exe is called with the path to your .sln file as its first argument.  The job of vslauncher.exe is to read enough of your .sln file to determine which version of Visual Studio to use to open your file.  Since you may have several versions of Visual Studio installed (VS2003, 2005, 2008, Express SKUs, etc.) you probably want to open the solution with the same copy of Visual Studio that you used to create it.

The issue comes up when your .sln file signature (the first two lines of your file) don’t match any known release of Visual Studio.  Visual Studio 2008 .sln files typically start with these two lines:

Microsoft Visual Studio Solution File, Format Version 10.00
# Visual Studio 2008

But suppose you have a .sln file that was created with a Visual Studio 2008 beta.  You might have a .sln file that starts with this instead:

Microsoft Visual Studio Solution File, Format Version 10.00
# Visual Studio Codename Orcas

When Visual Studio 2008 RTM reads this, it doesn’t recognize its earlier beta versions’ solution file signatures and just quits.  It would be nice if a user-friendly message telling what happened would pop up.  Alas, it does not.

Workaround

Simply open your .sln file in Notepad and change “Codename Orcas” to “2008” on the second line. 

[Update 2/16/08] This blog was featured on Channel 9, and as a result a couple of people wrote up a PowerShell script and a C# program to automate updating all your .sln files at once.  Very cool.

0 comments

Discussion is closed.

Feedback usabilla icon