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
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
Connect a team foundation server visual studio > team > manage connection > servers > add a new connection to tfs collection
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.
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
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
add/edit file(s) add some files in the folder:
vs > source control explorer > project > right click > add items
check in changes team explorer > pending changes
add comment > checkin
Add tfs ignore We can configure which kinds of files are ignored by placing text file called
.tfignorein the folder where we want rules to apply. The effects of the
.tfignorefile are recursive. Also, we can create
.tfignorefiles in sub-folders to override the effects of a
.tfignorefile 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 *.suo *.user *.sln.docstates # Build results bin obj #include nuget executable !NuGet.exe #nuget packages directory packages #include package target files which may be required for msbuild !packages/*.targets # ReSharper _ReSharper*/ *.ReSharper # TeamCity _TeamCity* # DotCover is a Code Coverage Tool *.dotCover # Click-Once directory publish/ # Publish Web Output *.Publish.xml *.pubxml # Backup & report files from converting an old project file to a newer _UpgradeReport_Files/ Backup*/ UpgradeLog*.XML UpgradeLog*.htm # Windows image file caches Thumbs.db ehthumbs.db # Folder config file Desktop.ini # VS 2015 folder .vs # node node_modules/
View changes of team collection, team project, a folder or a file. Compare different versions of a file.