Book Recommendations for Team Foundation Server 2013

As you can see, some have not been updated for TFS 2013, but their content is still valid.

Here’s my personal selection of books covering TFS 2012/2013:

ProTFS2013 Professional Team Foundation Server 2013

The ultimate reference for TFS. A “must-have”.
This book should not be missing on anyone’s shelve.
The definitive guide to agile software development with Visual Studio 2012 Visual Studio Team Foundation Server 2012: Adopting Agile Software Practices: From Backlog to Continuous Feedback (3rd Edition)

Written by the Product Owner of Visual Studio and Europe’s first MVP for TFS this book is recognized as a de facto guide for teams adopting agile practices.

Chapter 2: Scrum, Agile Practices, and Visual Studio (25 pages)
Chapter 9: Lessons Learned at Microsoft Developer Division (23 pages)

Doing Scrum with VS 2012? This is your book. Professional Scrum Development with Microsoft Visual Studio 2012
How to turn requirements into working software increments using:
- Scrum (as the project management framework)
- Modern, agile software development practices
- Supporting Tools from Visual Studio/Team Foundation Server

Sample chapters available for download.

Testing for Continuous Delivery with Visual Studio 2012 Testing for Continuous Delivery with Visual Studio 2012
(Microsoft patterns & practices)


This book is aimed at test engineers, managers, developers, and folks interested in understanding the changing world of test.

Note: This book is also available as a free download.

Enjoy the read!

–Neno

Getting the compile and test status as environment variables when extending TF Build using scripts

The Goal

When running custom batch or PowerShell scripts as part of TF Build, you want to access the compilation and test result using an environment variable.

The Solution

When you use the new TfvcTemplate.12.xaml build process template, it’s easy to run additional scripts or tools as part of the build process.

There is a tool available (TfbEnv.exe) that will create additional environment variables with the compilation/test results. It is free and can be downloaded here.

The tool will always set the following two environment variables:

  • TFB_COMPILATIONSTATUS
  • TFB_TESTSTATUS

The value corresponds to the current result (Succeeded, Failed, Unknown).

Additional environment variables:

  • If compilation succeeds, TFB_COMPILATION_SUCCESS is set to 1.
  • If compilation fails, TFB_COMPILATION_FAILED  is set to 1.
  • If tests succeed, TFB_TEST_SUCCESS is set to 1.
  • If tests fail, TFB_TEST_FAILED is set to 1.

How to use it

There are two ways to use it:

Option 1: Use TfbEnv.exe to generate a batch file which you can call from your scripts to set up the environment variables

  1. Create a batch file that invokes TfbEnv.exe and then calls “SetVars.bat” (which is created by TfbEnv.exe).

    Here’s a very simple example:

    TfbEnv-Batch-File
    (Note: In this example TfbEnv.exe is stored in a “build” folder in Version Control)
  2. In your build definition, set “Post-test script path” to run your batch file:
    TfbEnv-Batch-Parameters
  3. Done. Queue a new build!

Option 2: Use TfbEnv.exe to invoke your batch oder PowerShell script file with the additional environment variables available

  1. In your build definition, set “Post-test script path” to run TfbEnv.exe.
  2. Under Post-test script arguments use the “run” argument to specify the batch file or PowerShell script that you want to run.

    Here’s an example:

    TfbEnv-PowerShell-Parameters
    Figure: In this example, TfbEnv will set up the environment variables
    and then execute the PowerShell script “PostTest.ps1”
  3. Done. Queue a new build!

Note: TFS 2013 Update 2 (2013.2) is required. If you are not on Update 2, you can explicitly use the /collection (or just "/c") parameter to specify your TFS Collection URL.

Enjoy!

–Neno

 

Updated (May 21, 2014): Added a note that TFS 2013 Update 2 is required (+ workaround).

Updates (May 25, 2014): Updated this blog article to explain how to use the tool (2 options).

Writing the Build Report with Associated Changesets and Work Items to a file as part of the build

The Goal

TFS has a nice Build Reporting, including a list of associated changesets and work items (if any). You might want to have this information saved to a file during a build.

Figure 7.6 Build Report

The Solution

When you use the new TfvcTemplate.12.xaml build process template, it’s easy to run addition scripts or tools as part of the build process.

There is a tool available (TfbNotes.exe) that generates a build report in .TXT and .XML format. It is free and can be downloaded here.

All you need is to check-in the file into version control and reference it in the build process, for example at “3. Test” » “2. Advanced” » “Post-test script path”.

TfbNotes_Process

Note: To run more than a single tool, use batch files or PowerShell scripts.

Here’s how the .TXT output looks like:

TfsNotes.exe

Note: TFS 2013 Update 2 (2013.2) is required. If you are not on Update 2, you can explicitly use the /collection (or just "/c") parameter to specify your TFS Collection URL.

Enjoy!

–Neno

Updated (May 21, 2014): Added a note that TFS 2013 Update 2 is required (+ workaround).

Notifying users when a particular work item changes in TFS

The Goal

In TFS you can set up Project Alerts that alert users when work items change. But sometimes you would like to be able to add a list of people to be notified when a particular work item changes.

The Solution

You can achieve this by using a server-side plug-in.

Here’s a step-by-step guide:

  1. Enable SMTP settings for your TFS in TFS Admin Console (if not already done)
  2. Add a custom field to your work item types:
    Type = “string”, Reference Name = “TFS.CcNotificationReceivers”
    image
    … and display it on the Work Item form:
    image
  3. Install server-side plug-in:
    Get TFS.WorkItemTracking.CcNotifications.dll from here (for TFS 2013 only!) and copy it to the “PlugIns” folder, located at: %ProgramFiles%\Microsoft Team Foundation Server 12.0\Application Tier\Web Services\bin\Plugins
    (to uninstall, simply delete the .DLL again)
  4. Done. When you enter user names (or e-mail addresses) into the new field (separate multiple values with commas or semicolons), those users will be notified of any changes that happen to that particular work item.

image

Note: Server-side plug-ins work on TFS on-premises only (not with Visual Studio Online).

Enjoy!

–Neno

Turning off policy overrides in TFS

The Goal

Check-In policies have been around since the first version, TFS 2005, to help a team define a list of steps they want to perform prior the checking in. If a policy is not met, it alerts the user.

When policies fail, there is an option to “override” the warning(s) and continue with the check-in (the policy warnings will still be stored as part of the changeset).

Figure 6.6 CheckIn Policy Violations

While it’s easy to set up an alert to get notified when this happens, or query the TFS Warehouse to get a list of all overrides, there’s no built-in way to turn off overrides entirely.

The Solution

A server-side plug-in that intercepts all check-ins and rejects the changeset if it is a policy override. After activating the plug-in (which is simply a drag & drop of the plug-in .DLL into a specific folder on the TFS Application Tier), this is what happens if users try to override:

No Policy Overrides

How to set it up

  • To install, copy TFS.VersionControl.NoPolicyOverrides.dll to the “PlugIns” folder, located at: %ProgramFiles%\Microsoft Team Foundation Server 12.0\Application Tier\Web Services\bin\Plugins
  • Download the .ZIP package with all event-handlers here (for TFS 2013 only!).
  • To uninstall, just remove the .DLL from the “PlugIns” folder.

A word of warning

Disclaimer:
Server-side event handlers must be very well written. As they run inside of the TFS process itself, they can crash TFS, significantly degrade performance or change the behavior of built-in operations (e.g. a badly written plug-in could cause new team project creation to fail).

Note: Server-side plug-ins work on TFS on-premises only (not with Visual Studio Online).

Enjoy!

–Neno

Extending TFS’ default behavior using server-side plug-ins

In TFS 2005, Check-In Policies helped to ensure certain rules prior to check-in. However, check-in policies are executed locally and you must ensure they are available for the client (in the appropriate version) and installed.

In TFS 2010, Gated Check-Ins were introduced, which allowed validations such as the compilation, unit test execution and more (basically whatever the build script specified) to be run on the server-side and reject the check-in if they failed.

Also with TFS 2010, Microsoft introduced server-side plug-ins, which can handle TFS events and either react to them, or – in some cases – even cancel operations. Technically those plug-ins are implementing the ISubscriber interface (see this blog post how to write and debug them).

A word of warning:

Disclaimer:
Server-side event handlers must be very well written. As they run inside of the TFS process itself, they can crash TFS, significantly degrade performance or change the behavior of built-in operations (e.g. a badly written plug-in could cause new team project creation to fail).

Here’s an example:

Instead of using a check-in policy to enforce that changesets must have comments, a server-side plug-in could be used instead. This would guarantee that our rules are enforced, regardless of the client accessing TFS and if the appropriate check-in policy is available and installed for that client or not.

The server-side plug-in is installed by just copying a single .DLL to a “PlugIn” folder on the TFS Application Tier (or all Application Tier if you have more than one).

The following screenshots show how the message looks like that users will see that try to check-in without a comment.

In Visual Studio:

image
In Windows Explorer (via TFS Shell Extension from TFS Power Tools):

image
In Eclipse:

image

How to set it up

  • To install, copy TFS.VersionControl.RequireChangesetComments.dll to the “PlugIns” folder, located at: %ProgramFiles%\Microsoft Team Foundation Server 12.0\Application Tier\Web Services\bin\Plugins
  • Download the .ZIP package with all event-handlers here (for TFS 2013 only!).
  • To uninstall, just remove the .DLL from the “PlugIns” folder.

Note: Server-side plug-ins work on TFS on-premises only (not with Visual Studio Online).

Enjoy!

–Neno

From the KB: Performance decreases in TFS 2013 Update 2 after you upgrade to SQL Server 2014

From the Microsoft KB article:

“After you upgrade to Microsoft SQL Server 2014, you notice a decrease in performance in Microsoft Team Foundation Server (TFS) 2013 Update 2.”

“These issues occur because the hardware requirements for SQL Server 2014 are greater than those for ealier versions of SQL Server. “

Link: http://support.microsoft.com/kb/2953452/en-us

Article: The evolution of Microsoft’s solution for Application Lifecycle Management: Team Foundation Server

imagePieter Gheysens, a fellow Visual Studio ALM MVP, wrote an article over how TFS and Microsoft’s ALM platform in general evolved from its beginnings (2006 was the first public release) until today.

You can get the .PDF from his blog at: http://intovsts.net/2013/12/03/the-evolution-of-almtfs-pdf-available-for-download/

Enjoy!

–Neno

(formerly Team System, VSTS)