39

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

4

1 回答 1

62

发生这种情况是因为解决方案文件中包含源代码控制信息,而 .csproj 文件将只实现解决方案文件告诉它的内容。

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

SAK 指的是“应该已经知道”,因为它从解决方案文件中提取信息。解决方案文件应包含类似于下面显示的内容

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

现在可能发生的情况是,如果第一次签入解决方案和项目的人不包含 Solution.vssscc 文件,那么 Visual Studio 无法确定源代码管理。如果发生这种情况,请删除 vssscc 文件并关闭解决方案。重新打开解决方案将创建一个新的 vssscc 文件,确保将其重新签入源代码控制。

添加项目时要检查的另一件事是确保解决方案文件被签出,然后在您提交项目时再次签入。

只要源代码管理正确处理了解决方案文件和 vssscc 文件,那么当您添加新项目时,它应该从解决方案文件中获取源代码管理设置,然后将 SCC 节点应用于新项目

于 2014-08-14T13:33:52.183 回答