46

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

user2323704
  • 853
  • 1
  • 7
  • 13
  • You can view the history (perhaps best looking at annotated history - "blame reporting") to see why those lines were removed. I'm not sure I entirely understand your question about those lines, they indicate that the project is bound to source control. (Without it, you have a strange configuration and thus are prompted to fix it every time you open your project until you do.) – Edward Thomson Aug 27 '13 at 15:31
  • 1
    I've ran into this when upgrading projects from pre-TFS2010 to TFS2012. – Andrew Clear Aug 27 '13 at 17:43
  • 3
    The problem is not that someone have edited the *.csproj and removed those lines. I am adding a new projects and in all of them those lines are missing. Visual Studio is not adding them even though the projects are bind to TFS... – user2323704 Aug 28 '13 at 06:10
  • 4
    ... and Visual Studio is not able to fix it automatically, so all the time I receive the annoying message. – user2323704 Aug 28 '13 at 06:16
  • When you are adding your new project is the solution file being checked out? does the solution file have the correct settings for your source control? – Just TFS Jul 18 '14 at 10:53

1 Answers1

72

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

Just TFS
  • 4,697
  • 1
  • 18
  • 22