Exercise 1: Working with TFS 2010 Code Branches

In this exercise, you will learn about some of the new code branch features in Team Foundation Server 2010 and how to open a solution that corresponds to a specific code branch. In addition, this exercise will serve as the setup for a scenario where production code needs to be updated and the changes ultimately merged through active branches in the system.

  1. Log in as Abu Obeida Bakhach (Dev) if you have not already done so. The password is P2ssw0rd (capital letter P, the number two, the letter s, the letter s, the letter w, the number zero, the letter r, and the letter d). Please see “Working with the Visual Studio 2010 Virtual Machine” for instructions on how to log into the VM.
  2. Open Microsoft Visual Studio from Start | All Programs | Microsoft Visual Studio 2010 | Microsoft Visual Studio 2010.
  3. Open the Source Control Explorer window from View | Other Windows | Source Control Explorer.
  4. The Tailspin Toys solution contains a Main code base as well as branches under development and release. In Team Foundation Server 2010, branches are now first-class objects that are represented with their own icon in Source Control Explorer.

    Figure 1

    Source Code Explorer showing folder and branches

  5. Right-click on the Production 1.0 branch node and select Properties from the context menu that appears. The Properties window provides general details like version and description, hierarchical relationship to other branches, and permissions.

    Figure 2

    Properties window for code branch

  6. Select the Cancel button to return to Source Code Explorer.
  7. Select the Production 1.0 branch node in the Releases folder and double-click on the TailspinToys.sln solution file to open it.
  8. Rebuild the solution (Build | Rebuild Solution from the main menu). This step may take a few minutes to complete.
  9. Ensure that the Tailspin.Web project is set as the startup project (right-click and select Set as StartUp Project).
  10. Press Ctrl+F5 to launch the Tailspin Toys website.

    Figure 3

    Default page for Tailspin Toys website

  11. Imagine a scenario where the Production 1.0 branch represents the code that is currently running on the production web server. Management has decided that the non-functional links in the page footer should be removed as soon as possible. We have decided to “fast track” this change by making the update directly to the Production 1.0 branch. Later, you will see how we can merge this change back to the branch for the current iteration (Iteration 2) so that it becomes a part of the changes we’re working on for the next release. You will now see how the new branching and merging capabilities in Team Foundation Server 2010 facilitate such a scenario. Close the Internet Explorer window and return to Visual Studio.
  12. Our first task is to update the production branch and deploy the changes to the production web server. From Solution Explorer, open Template.Master from the Tailspin.Web project under the Production 2.0 branch.
  13. Scroll to the bottom of the Template.Master page and locate the list item HTML for the footer links. Comment out the Careers link through the Shipping Options & Charges link as shown below.

    Figure 4

    Modified Template.Master page

  14. Press Ctrl+F5 to launch the website and verify that the non-functional links are no longer displayed. For the purposes of this demonstration, assume that at this point we have successfully deployed the updated change to the production server.
  15. Close the Internet Explorer window and return to Visual Studio.
  16. Open the Pending Changes window from View | Other Windows | Pending Changes.
  17. In the Comment field, enter “removed non-functional links from footer”, check the checkbox next to the Template.Master file, and select the Check In button. When prompted to confirm check-in, select the Yes button.

    Figure 5

    Checking in the change to the Production 1.0 branch

  18. In the next exercise we will merge the changes through other branches in the system.

Next Step

Exercise 2: Branching and Merging Visualization