Recently while using VS.NET 2010 I had an unsettling feeling when I opened my solution file (.sln) that I have been working on for the past 3 years to find that only 1 of the 3 associated projects opened up. Well I immediately knew everything was ok because all of the directories, etc. still existed for the unopened projects, so I had to figure out how to fix the problem.
This particular problem occurred due to a corrupted .sln file. The .sln file associated with a VS.NET solution contains the meta data in text format of the associated project and source control information. To see this information, navigate to the .sln file in Windows Explorer and right click to select 'Open with' and select either Notepad or WordPad.
You will be able to see associated project information, along with the project GUID, source control information, and other meta data. For whatever unexplained reason, my .sln file only had the details for a single project in the solution, and therefore was being the only one opened up in VS.NET. I didn’t want to start adding projects manually via the IDE thinking that could cause a mess. The solution lies in correcting or replacing the .sln file.
I chose to go to my source control provider and get a 2nd most recent version of the .sln and placed it in a separate location from the real .sln file to inspect. Upon opening the version from source control, I found the details for all (3) projects as expected. There are (2) ways to fix the issue at hand now, and I recommend making a backup of everything before making any modifications to this file in case there is an issue.
I chose to copy everything out of the properly formatted .sln and paste it into the corrupted .sln file and then reopen the solution. The other option would be to simply replace the .sln file directly.
After reopening VS.NET, I didn't use any quick links on the home page and manually navigated back to the .sln file to open the solution. I received one warning/option box stating what was loaded was not the same as in Source Control (because I had modified the .sln manually), and told me it would notify me of issues or differences, which there were not any. I had to reset the startup project and startup .aspx page and all was back to normal.
Post a Comment