Exercise 3: Local Workspaces

In this exercise, you will learn about local workspaces and how they improve the offline development experience.

  1. Open the FabrikamFiber.CallCenter solution from the Dev branch in Source Control Explorer.

    Figure 20

    Source Control Explorer window

  2. Prior to Team Foundation Server 11, source control operations were performed exclusively on the server, so working in a disconnected, offline scenario was oftentimes tedious. To improve the development experience for smaller teams and projects, Local Workspaces have been introduced that provide a more client-centric workflow, a style of version control often described as Modify-Merge-Commit.
  3. As an aside, server-based workspaces, which are better suited for larger projects, can still be used. Load the Manage Workspaces window by typing ‘workspaces’ into the Quick Launch search box in the top-right corner of Visual Studio and wait a second or two for the results to load.

    Figure 21

    Location of Quick Launch bar

    Note:
    The Quick Launch search box is new to Visual Studio 11 and it can save you time that you would have otherwise spent clicking through menus to reach various tools and commands. Use the Ctrl+Q key combination to avoid the mouse altogether.

  4. Select the Workspaces… command link.

    Figure 22

    Selecting the Workspaces link

  5. In the Manage Workspaces window, select the Add… button to start creating a new workspace.

    Figure 23

    Location of Add button to create new workspace

  6. In the Add Workspace window, select the Advanced button to see all available options.

    Figure 24

    Location of Advanced button to view advanced workspace properties

  7. Locate the Location workspace property. By default, new workspaces will use local workspaces, but you can choose to create a server-based workspace if desired.

    Figure 25

    Choosing between Local and Server workspace

  8. Close the workspace windows by pressing the Escape key twice.
  9. In Solution Explorer, expand both the FabrikamFiber.Web project and then the Content folder.

    Figure 26

    Navigating to the Content folder of FabrikamFiber.Web project

  10. Single-click the fullcalendar.css file to view its contents. Note that the file is loaded in the CSS Source Editor as expected, but the tab for it is shown on the right-hand side. This new tab type is called a preview tab – as you use the arrow keys to navigate between files or single-click on them, the preview tab will be replaced with the most recent selection. Preview tabs help address the problem where you can easily overwhelm your Visual Studio tab real estate with files that you only need temporarily.

    Figure 27

    Preview tab

    Note:
    There is a button within the preview tab itself that allows you promote it to a regular tab. See the arrow in the screenshot above.

  11. Make an arbitrary change to the fullcalendar.css file by changing one of the style properties. Visual Studio will indicate that the file has been checked out, but keep in mind that this has only been done in the local workspace. Other team members will not see that you are working on this file.

    Figure 28

    Check mark next to file shows that you have made changes to it locally

  12. Two of the major benefits of the local workspaces are that the disconnected, offline work scenario is greatly improved, and it is much easier to use external tools to work with files in source control. To demonstrate both of these benefits in action, let’s proceed by stopping the Team Foundation Server site in IIS. This will simulate a scenario where you are working offline, such as writing code from the beach. In a real-world scenario, you would never write code from the beach - you would be enjoying your vacation.
  13. Load Internet Information Services (IIS) Manager from Start | All Programs | Administrative Tools.

    Figure 29

    Shortcut location for IIS Manager

  14. In IIS Manager, expand the VSALM server node and the Sites node to find and select the Team Foundation Server site.

    Figure 30

    Stopping Team Foundation Server

  15. In the Actions pane, select the Stop button (see screenshot above for button location).
  16. Return to Visual Studio, load the Source Control Explorer window, and select the refresh button. Note that the window is now in a disconnected state.

    Figure 31

    Source Control Explorer in disconnected state

  17. Even though we are now in a disconnected state with Team Foundation Server, we can continue to do work. Right-click on the Content folder in Solution Explorer and select the Open Folder in Windows Explorer option.

    Figure 32

    Location of option to open folder in Explorer

  18. Add a new file into the Content folder by right-clicking in a blank area of the view and selecting New | Text Document from the context menu.

    Note:
    We will use this file in a demonstration a little later – the contents are not important.

    Figure 33

    Creating a new text document

  19. In the Explorer window, right-click on the Site.css file and select Open With | Notepad from the context menu.

    Figure 34

    Opening a checked-in file with Notepad

  20. In Notepad, change the ‘body’ style color to ‘red’.

    Figure 35

    Editing a file in Notepad and saving changes

  21. In Notepad, save and close the Site.css file and return to Solution Explorer. Note that Visual Studio detected the change to the file and that the file was not read-only as it would have been in the case of a server-based workspace.

    Figure 36

    Visual Studio shows that the file has changed