Visual Studio .NET 2003 solution files with corrupted source control settings
Spent entirely too much time today figuring out why Visual Studio .NET 2003 solutions sometimes get wedged in a "some of the properties associated with the solution could not be read" state.
The solutions appear to be okay otherwise, but each time they are opened, you get the error message.
The problem is introduced when projects are added to the solution. I’ve observed it with web application projects already under Perforce source control.
The solution file (.sln) will have a SccNumberOfProjects value greater than the actual number of projects and there will be duplicates of some projects. The duplicates are typically missing the SccProjectFilePathRelativizedFromConnection# property.
To fix the problem (or at least to get rid of the error message):
1. Adjust the SccNumberOfProjects property value to the expected number.
2. Delete duplicate SourceCodeControl information. The usual sequence of properties is something like:
GlobalSection(SourceCodeControl) = preSolution
SccNumberOfProjects = 11
SccProjectName0 = Perforce\u0020Project
SccLocalPath0 = .
SccProvider0 = MSSCCI:Perforce\u0020SCM
CanCheckoutShared = true
SolutionUniqueID = {A0C7BB98-83C3-491B-9A97-CDE906E50E22}
SccProjectUniqueName1 = http://localhost/jq/h/JobQuake\u0020Help.csproj
SccLocalPath1 = JobQuake\u0020Help
CanCheckoutShared = true
SccProjectFilePathRelativizedFromConnection1 = http://localhost/jq/h
SccProjectUniqueName2 = http://localhost/jq/a/JobQuake\u0020Admin.csproj
SccLocalPath2 = JobQuake\u0020Admin
CanCheckoutShared = true
SccProjectFilePathRelativizedFromConnection2 = http://localhost/jq/a
3. Adjust the trailing indices on SccProjectUniqueName, SccLocalPath, and SccProjectFilePathRelativizedFromConnection to run from 1 to SccNumberOfProjects, inclusive.
Comments
Had this problem too. I followed your instructions and fixed it. Thanks very much for putting this up.
Posted by: John Woakes | March 30, 2004 12:20 PM
I also had this problem. Your instructions fixed it. Thanks!!
Posted by: joe miller | July 12, 2005 04:08 PM
Thanks, your solution helped me too!
Posted by: Bruce Glowacki | October 18, 2005 05:28 PM
Note that the text:
SCC = This is a Source Code Control file
is required at the top of the *mssccprj.scc* file, or you'll also get this message.
Posted by: Carlo Caci | December 9, 2005 12:51 PM
Thanks for this sanity saver! It worked. You just saved me the wrath of my entire team, who have been viewing this annoying message every day, every week. I guess the most relief is the feeling of being back in control. It's like Visual Studio laughs at you each time you open the solution ... here's an obscure error message and there's nothing that you can do about it ... hahah.
For anyone else doing web searching and finding this post, here's a few keywords ... we had a web project included, and during the lifetime of the .sln file we'd renamed a few projects. Seems like Visual Studio gets a bit confused at times. Goodness knows what it's doing with all that junk duplicate information (between the last 'GlobalSection(SourceCodeControl) = preSolution' section in the file).
By the way, same corruption seems to still apply to Visual Studio 2005, which is what we're using now (makes you wonder why they didn't make the .sln file xml based!).
Posted by: Warren Bullock | February 26, 2006 08:43 AM