views:

86

answers:

3

Sometimes, for unknown reasons, VS 2008 creates solution files led by a newline.


Microsoft Visual Studio Solution File, Format Version 10.00
# Visual Studio 2008
[...]

This happened on various machines, and I have no idea why this is. A Google search did not yield any useful results.

Now, why do I worry about this? Because I can't open these solutions in Windows Explorer. I have to open VS, select File -> Open -> Solution and it works fine. But to open solutions from within Explorer, I have to edit the sln file and remove the leading newline.

Edit: After Leom's suggestion I tested a few times and found that the issue is solely dependent on the leading newline.

Edit: Interesting: VS 2010 displays the same behavior the other way around: It only works with a leading newline! At least on some solutions - on other solutions it's exactly the same as with VS 2008. I'm confused.

+1  A: 

I too have a blank line in my solution files, but I do not have this issue.

I did some digging, it appears that solution files actually launch the Visual Studio Version Selector, and the first 2 lines (not sure if it the actual first 2 lines, or the first 2 lines of text) of the sln file act as the input parameters for this selector, link.

There could have been a possible corruption of this executable.

In addition, you may try in Visual Studio Tools->Options->Environment->General and choose the "Restore File Assoications"

blog post here.

gooch
A: 

Visual Studio solution files, for unknown reason, have to start with empty line. Your problems are probably not related to presence/absence of new line, but to encoding -- if SLN file is edited outside VS, it may be saved without Byte Order Mark (BOM). Try opening SLN file in notepad and do Save As -> Select UTF-8 encoding.

Srdjan Jovcic
A: 

I too faced the same issue. I observed this scenario after doing a reverse merge using IBM rational clearcase. It introduced a blank line at the beginning of the ".sln" file during reverse merge. To resolve this I opened the sln file in an editor (i used VI) and removed the blank line and saved the file. Then the file opened up in visual studio with a double click.

MUSTAQ

related questions