user1345223
user1345223

Reputation:

What does VS project binding do?

What does Visual Studio's unbind | bind operation do to projects in a solution.suo file?

Microsoft provides instructions on How to: Bind or Unbind a Solution or Project, which happens to remedy the dreaded "Unspecified Error" that occurs at solution opening. This MSDN forum posting has a user stating they unbound and then re-bound their projects in order to solve that problem.

As I was experiencing the same "Unspecified Error" problem, I did some additional digging and found that the solution.suo file was the only likely candidate that had changed after I had resolved the issue.

I read this answer to an SO question about .suo files being effectively disposable and happened to be able to recreate the UE problem through a stale workspace I had laying around. So I went ahead and deleted the solution.suo file and opened the solution.sln file. Magically, my UE problem had gone away with that workspace too.

That led me to conclude unbind | bind has some sort of effect on the .suo file, but because of the files binary, proprietary structure I wasn't able to identify what's going on.

My Questions:
1. So what exactly does Visual Studio's unbind | bind operation do to projects in a solution.suo file?
2. Can anyone surmise what's causing these "Unspecified Errors" now that I've find the linkage to the .suo file?


Footnote 1: This MSDN article explains a little bit about .suo files, but doesn't really go into details.

Footnote 2: "Unspecified Error" on project / solution opening appears to be quite the bête noire as evidenced by here, various searches, and this old MS KB

Upvotes: 5

Views: 2011

Answers (2)

Jonathan
Jonathan

Reputation: 7561

VS project binding stores which projects are managed by source control. It is saved in the .SLN file.

Unfortunately, the format in which it's save is hard for source control systems to merge. Therefore, the bindings often get corrupted, leading to erroneous "Projects have been added to source control" messages when loading the solution. The procedure to fix this is to delete that entire section from the .sln file, open in VS, and then re-bind the solution, which will create the section correctly.

BTW, the whole solution file format is quite awful for merging. It smells like VS6, and the source control section smells like SourceSafe. I wish they'd move to some MSBuild-based format, like they did with (almost all) project files.

Upvotes: 2

Hans Passant
Hans Passant

Reputation: 942138

Sure, the .suo file is where Visual Studio stores the state of the IDE. So that when you open a solution again later, everything restores the way you left it off. The most obviously visible effect is that windows restore in their original position and size. And yes, the binding of the solution to the specific source control server where you want the changes to be checked in could well be stored there as well, it is the logical place for it.

"Unspecified error" is a very generic COM error code named E_FAIL. Visual Studio uses a lot of COM code, the add-in system is entirely COM based. It is a lousy error because it doesn't mean anything more than "it didn't work, don't know why". Similar to returning false from a function. There's a programmer at Microsoft somewhere that could have done a better job reporting the problem. Maybe that wasn't so easy.

Upvotes: 2

Related Questions