azure-devopstfsvisual-studio-2015tfvc

How to branch my Visual Studio Online (TFS) Solution?


I have a fairly complex solution in Visual Studio 2015. It's source controlled using Visual Studio Online with TFS as the source control mechanism.

The structure is as follows:

DefaultCollection
    Team Project Root
        |
        ----Web Apps Folder
              |
              ----Web Application 1
                    |
                    ----WebApplication1.csproj
              |
              ----Web Service 1
              |
              ----Web Service 2
        |
        ----Winforms Folder
              |
              ----Winforms App 1
              |
              ----Winforms App 2
        |
        ----Common Files Folder
        MySolution.sln

MySolution.sln is in the Team Project Root, and the solution contains all the various applications within it which are a mixture of web apps, web services and Windows applications.

The problem I have is that I am new to branching and I want to branch the entire solution, but I think that the way my SLN file is in the root will make this difficult?

What I need is to have Web Application 1 branched, and I understand I can branch Web Application 1. But in order to run it I would need to create a new solution file to contain it which would mess things up.

Is there a way I can Branch the entire solution from this scenario, or will I have to try to re-structure things somehow?


Solution

  • I would Create a new Folder at Team Project Root called Main (TFS Convention, SVN it's trunk, git it's master).

    Then move all the items in the Team Project Root into that Main folder.

    So your structure is now:

    DefaultCollection
        Team Project Root
            |--Main
              |--Web A pps Folder
                |--stuff     
              |--Winforms Folder
                |--stuff
              |--Common Files Folder
              MySolution.sln
    

    Now you can right click on the Main folder and from the Branching and Merging sub-menu select Convert to Branch.

    enter image description here

    Now you can right click on Main branch, and from the Branching and Merging sub-menu select Branch...

    enter image description here