Team foundation server tutorial (1) - Introduction

Posted by Andy Feng on August 1, 2018


Version control systems are software that help us track changes we make in our code over time. As we edit to our code, we tell the version control system to take a snapshot of our files. The version control system saves that snapshot permanently so we can recall it later if we need it.

Team Foundation Server (TFS) is a collaboration tool including version control, . It is integrated with Visual Studio and enables a team to work together and organize efforts to complete a project. Dot Net developers use TFS for source control, bug tracking, requirement gathering and to manage complete lifecycle of software development.

Structure of a team project

  • src: source code of the complete solution
  • db: ddl, stored procedure, sql query scripts
  • docs: design document, installation manual, user manual, - references
  • resources: 3rd libs, dlls, runtime tools

TFS Fundamentals

There are some terminologies of TFS:

team project is an individual project of a team.

collection is a group of related projects.

workspace is a a mapping of one or more local working folder(s) to one or more source control folder(s) in TFS. TFS syncs the client and the server based on workspace.

Check out a team project

  1. Connect a team foundation server visual studio > team > manage connection > servers > add a new connection to tfs collection

    connected successfully

  2. Connect to a team project
    select a team project > connect

    Now we’ve defined our connection to team foundation server. The next thing we need to do is create a workspace so that we can begin performing operations.

  3. Create a workspace

    A workspace defined what code will be brought from the server to the client and where on the client the code will live. It is essentially a mapping between server and client, and determines how server and client sync.

    vs > team explorer > source control explorer


    local path > click not mapped > specify a path


    workspace > workspaces > add or edit > add or edit the mapping of team project(s) under a collection between server and client

  4. Download source code vs > team explorer > source control explorer > left panel of folders > select a team project > right click > get latest version

    By default, we grab the latest code and sync client with server. We can download code via multiple ways:

    • latest (default)
    • by specific version
    • by date
    • by label
    • by workspace version

Check in a team project

  1. add/edit file(s) add some files in the folder:

    vs > source control explorer > project > right click > add items

  2. check in changes team explorer > pending changes

    add comment > checkin

More commands

  1. Add tfs ignore We can configure which kinds of files are ignored by placing text file called .tfignore in the folder where we want rules to apply. The effects of the .tfignore file are recursive. Also, we can create .tfignore files in sub-folders to override the effects of a .tfignore file in a parent folder. This file helps us check in clean code to server.

    Here is a ignore configuration for visual studio project:

         # User-specific files
         # Build results
         #include nuget executable
         #nuget packages directory
         #include package target files which may be required for msbuild
         # ReSharper
         # TeamCity
         # DotCover is a Code Coverage Tool
         # Click-Once directory
         # Publish Web Output
         # Backup & report files from converting an old project file to a newer
         # Windows image file caches
         # Folder config file
         # VS 2015 folder
         # node
  2. View changes of team collection, team project, a folder or a file. Compare different versions of a file.