“There appears to be a discrepancy between the sol

2019-04-22 04:03发布

问题:

We get this error in Visual Studio 2005 and TFS very often.

Can anyone help us pinpoint the cause for this message?

The full message is:

There appears to be a discrepancy between the solution's source control information about some project(s) and the information in the project file(s).

To resolve this discrepancy it will be necessary to check out the project file(s) and update them. If the check out fails, however, and the solution is closed without saving, you will see this warning again the next time you open the solution.

Clicking OK eventually lead to a checkout box where it wants to check out a whole list of project files. However, the "Change source control" window doesn't show anything wrong, and saving everything and just checking it back in just ends up as "Nothing was changed, undoing everything" type of message.

Edit: You're right, @Adam, we have converted from VSS, but we went through such a procedure to cleanup the bindings when we did this a while ago and everything was peachy. The error has started cropping up lately.

回答1:

Sounds like you you moved the project from VSS to TFS, and the original solution file is still bound to VSS - you need to rebind it to TFS.

Here are the steps you'll need to do to fix this. I'd bring an excerpt here, but it appears to depend on several factors and isn't trivial.

Alternately, here's a thread that touches on project binding/unbinding which might apply if the above doesn't.

-Adam



回答2:

We have 2 solutions and hundreds of projects.

I migrated from VS 2008 SP1 to VS 2010 SP1 and was also receiving the error:

There appears to be a discrepancy between the solution's source control information . . .

I would open solution1, allow it to update the projects, then open solution2, only to get this error again.

I analyzed the solution files and found the following:

Root Cause:

solution1.sln and solution2.sln files are inconsistent with each other in regards to the project source control bindings.

Example:

solution1.sln

SccProjectUniqueName6 = Project1\\Project1.csproj
SccProjectName6 = \u0022$/Project1\u0022,\u0020HSBAAAAA
SccLocalPath6 = Project1

solution2.sln

SccProjectUniqueName6 = Project1\\Project1.csproj
SccLocalPath6 = .
SccProjectFilePathRelativizedFromConnection6 = Project1\\

Solution:

I fixed this issue by manually modifying the solution files to be consistent in notepad. I copy and pasted the source control info from solution1.sln into solution2.sln for projects they had in common.

I eventually wrote a small utility to automate this.

https://github.com/bentoo/MergeSolutionSourceControl