Why missing <SccProjectName> in project file cause "The project file is not bound to source control"

StackOverflow https://stackoverflow.com/questions/18467994

  •  26-06-2022
  •  | 
  •  

Question

I had a very annoying problem, I have found a solution, but I would like to ask you why it behaves like that...

I am using Visual Studio 2012 with TFS 2012. Everything was fine, but one day I have spotted a problem. When I have added a new project to my solution, then I have always obtaining this message every time I have reopened the solution:

This project file ... is not bound to source control, but the solution contains source control binding information for it. Do you want...

Whatever I have done, I still have this message. In the File->Source Control->Advanced->Change Source Control...' window every thing was fine. The *.vspscc files where properly created with good content. I was removing the binding and adding it again and again, but it was not helpful. All the time I had this annoying message...

And then I have spotted one difference in the *.csproj files. My problematic project did not have the following XML data:

<SccProjectName>SAK</SccProjectName>
<SccLocalPath>SAK</SccLocalPath>
<SccAuxPath>SAK</SccAuxPath>
<SccProvider>SAK</SccProvider>

When I have added those lines, problem was solved...

Is there anyone who can tell me why those elements where missing and why they cause such never-ending problem with annoying message about solution binding?

Thank you

Was it helpful?

Solution

This happens because the Solution file has the Source Control Information in it and the .csproj file will just implement what the solution file tells it.

<SccProjectName>SAK</SccProjectName>
<SccLocalPath>SAK</SccLocalPath>
<SccAuxPath>SAK</SccAuxPath>
<SccProvider>SAK</SccProvider>

The SAK referes to "Should Already Know" as it pulls the information from the solution file. The solution file should contain something similar to what is shown below

GlobalSection(TeamFoundationVersionControl) = preSolution
        SccNumberOfProjects = 4
        SccEnterpriseProvider = {3BA58AB2-18FA-4F8D-95D4-32DDF27D184A}
        SccTeamFoundationServer = http://TFSSERVER:8080/tfs/DPC
        SccLocalPath0 = .
        SccProjectUniqueName1 = Project1\\Project1.csproj
        SccProjectName1 = Project1
        SccLocalPath1 = Project1
        SccProjectUniqueName2 = Project2\\Project2.csproj
        SccProjectName2 = Project2
        SccLocalPath2 = Project2
        SccProjectUniqueName3 = Project3\\Project3.csproj
        SccProjectName3 = Project3
        SccLocalPath3 = Project3
        SccProjectUniqueName4 = Project4\\Project4.csproj
        SccProjectName4 = Project4
        SccLocalPath4 = Project4
    EndGlobalSection

Now what can happen is that if the person first checking in the solution and projects doesn't include the Solution.vssscc file then Visual Studio can't determine the source control. if this occurs delete the vssscc file and close the solution. reopening the solution will create a new vssscc file, ensure this gets checked back into source control.

Another thing to check when adding a project make sure that the solution file gets checked out and then checked back in again when you submit the project.

As long as the solution file and vssscc file are handled correctly by source control then when you add a new project it should pick up the source control settings from the solution file and then apply the SCC Nodes to the new project

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top