TFS: Merging .csproj files between two branches th

2019-08-28 00:41发布

I'm having a problem with merging dev branch into main branch when .csproj project files in those branches each have other project references in their said branch. For example, imagine the TFS source control structure below:

  • Web Project 1 (TFS Team Project)
    • Dev Branch
      • MyWebsite.csproj
    • Main Branch
      • MyWebsite.csproj
        • Web Project 2 (TFS Team Project)
    • Dev Branch
      • MyWebsite2.csproj
    • Main Branch
      • MyWebsite2.csproj
  • Database Project (TFS Team Project)
    • Dev Branch
      • MyDatabase.csproj
    • Main Branch
      • MyDatabase.csproj
        • Other Common Library (TFS Team Project)
    • Dev Branch
      • MyClassLibrary.csproj
    • Main Branch
      • MyClassLibrary.csproj

In reality, the structure is a bit more complex than the above as there are more projects that have the same branch structure, but the problem to be solved is the same.

The Website Project Dev Branches reference the Database and Common project Dev Branches, and the Website Project Main Branches referenc the Database and Common Project Main Branches. For example, the reference in the MyWebsite.csproj file might be:

    <ProjectReference Include="..\..\Database Project\Dev Branch\MyDatabase.csproj">
  <Project>{312ced42-f890-4d64-b27d-9ae53a42304c}</Project>
  <Name>MyDatabase</Name>
</ProjectReference>

So, you're making changes in the dev branches, and the .csproj files in the dev branch are properly referencing the other .csproj files in the dev branch; but when you go to merge the dev branch into the main branch, the .csproj files are trying to update the references from the trunk branch to the dev branch.

What is the best practice to resolve this issue so that when you merge from dev to trunk, the trunk projects still properly reference the other trunk projects and don't get updated to dev branch references?

edit looking for a non-nuget suggestion and am not able to combine them under one branch because the actual structure is far more complicated than outlined above. There are 3 separate web applications in 3 separate TFS team projects that reference several of these common libraries, which are also each in their own TFS projects. And then each of these team projects have dev and main branches.

1条回答
干净又极端
2楼-- · 2019-08-28 01:22

If these things are versioned separately, stop relying on project references. Turn them into NuGet packages, publish them to a NuGet feed, and rely on NuGet references to restore the correct version.

If these things are not versioned separately, put all of them under the same branch and rely on relative paths for your project references that do not include the branch folder name.

查看更多
登录 后发表回答