TFS & Visual Studio ALM - by Neno Loje

TFS & Visual Studio ALM - by Neno Loje

(formerly Team System, VSTS)

News

Recent Posts

Community

Tags

Email Notifications

VSTS Blogs

VSTS Community

My Other Blogs

German VSTS Websites

Archives

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

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

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

Screen Gallery: Upgrading TF Build from 2012 to 2013

Here are the screenshots from upgrading a TF Build from 2012 to 2013.2:

TFB 2013 Upgrade - 01

TFB 2013 Upgrade - 02

TFB 2013 Upgrade - 03

TFB 2013 Upgrade - 04

TFB 2013 Upgrade - 05

TFB 2013 Upgrade - 06

TFB 2013 Upgrade - 07

TFB 2013 Upgrade - 08

Good luck!

--Neno

Screen Gallery: Upgrading TFS 2012 to TFS 2013

Here are the screenshots from upgrading a TFS 2012.3 to TFS 2013.2:

TFS 2013 Upgrade - 03

TFS 2013 Upgrade - 04

TFS 2013 Upgrade - 05

TFS 2013 Upgrade - 04

TFS 2013 Upgrade - 06.2

TFS 2013 Upgrade - 06

TFS 2013 Upgrade - 07

TFS 2013 Upgrade - 08

TFS 2013 Upgrade - 09

TFS 2013 Upgrade - 10

TFS 2013 Upgrade - 11

TFS 2013 Upgrade - 12

TFS 2013 Upgrade - 13

TFS 2013 Upgrade - 14

TFS 2013 Upgrade - 08

TFS 2013 Upgrade - 09

TFS 2013 Upgrade - 10

TFS 2013 Upgrade - 11

TFS 2013 Upgrade - 12

Good luck!

--Neno

Updated Tools for TFS 2013

Meanwhile I updated most of my tools for TFS 2013. Here’s a list:

  • TfsClean.exe – Finds and deletes old and unused workspaces and shelvesets.
  • TfsCreateBuild.exe – Creates “fake” builds in TFS without actually running them.(e.g. can be used to store the build results from a different build system)
  • TfsExport.exe – Download files from TFVC without the need for a workspace, set modified date to last check-in date, and remove VC bindings.
  • TfsMoveDescriptions.exe - Moves text from plaintext or HTML fields to another HTML field (e.g. to copy the work item descriptions to the new System.Description field).
  • TfsRefreshWarehouse.exe - Processes the TFS Data Warehouse and Services Cube.
  • TfsReg.exe – Reads or writes values from/to the TFS registry.
  • TfsSyncIdentities.exe – Foces TFS to synchronize identities with Active Directory.
  • TfsWarehouseController.exe – Allows you to set warehouse settings (like the refresh interval).

The most convenient way to get all the tools is to download this .ZIP file: TfsToolsSuite.zip

But wait, there’s more…

Server-Side Plug-Ins:

Download all event-handlers as .ZIP file: TfsEventHandlers.zip.

TF Build Tools:

  • CreateZip.exe
  • FtpUpload.exe
  • TfbEnv.exe - Sets additional environment variables for TF Build.
  • TfbNotes.exe - Writes build report to a file.
  • TfbNuGet.exe
  • TfbSetVer.exe
  • VerifyFile.exe

Download all event-handlers as .ZIP file: TfsBuildTools.zip

Let me know if you find them useful!

--Neno

Visual Studio Online (VSO) vs. Team Foundation Server (TFS)

This blog post is comparing the current feature set of Microsoft's hosted TFS solution – Visual Studio Online (VSO) and the on-premises Team Foundation Server product.

Feature Comparison (as of February 2014)

 

TFS

VSO

Work Items, Version Control, & Build

Yes

Yes

Agile Product/Project Management

Yes

Yes

Test Case Management

Yes

Yes

Heterogeneous Development (Eclipse, Git)

Yes

Yes

Ease of Installation and Setup

+/-

++

Collaborate with anyone, from anywhere

+/-

++

Data stays inside your network

Yes

No

Process Template & Work Item Customization

Yes

No

SharePoint Integration

Yes

No

Data Warehouse & Reporting

Yes

No

CodeLens Support

Yes

No

Cloud Load Testing

No

Yes

Application Insights

No

Yes

Always running the latest version of TFS

No

Yes

Remember: Visual Studio Online is currently a so-called “commercial preview”.

Some other limitations of VSO (as of February 2014)

  • No Data Export (there are plans to make it available for a short time period)
  • No Data Import (if you want to move from on-premises TFS to VSO)
  • No Integration with Active Directory (users sign in using Microsoft Accounts)
  • No choice of geographic location (data stored in data center in Chicago)

--Neno

When to use the Test Attachments Cleaner (and when not)

What is the Test Attachment Cleaner?

A command line tool that only removes the attachments. It does not touch the test runs, which contain the pass/fail data. So, running Test Attachment Cleaner will not impact the record of the test runs.

You need to Test Attachment Cleaner if you:

  • Do manual test runs and want to delete attachments without deleting the test runs
  • Do automated test runs and want to delete attachment for builds which have been deleted already, but the build definition’s retention policy was not set to delete “test results” (because this is turned off by default)

You do not need the Test Attachment Cleaner if you:

  • Have automated test runs triggered by a build, and you have configured the build definition’s retention policy to delete “test results” (which is not set by default)
  • Delete the Test Runs manually (as this deletes the attachments)

Where do I get it from?

The Test Attachment Cleaner is available as part of the TFS Power Tools:

(Thanks Ravi Shenker from Microsoft for the input!)

SOLVED: TF221122: Error While Processing TFS OLAP Cube

The Problem

After upgrading to TFS 2013, the TFS OLAP Cube fails processing with one of the following messages:

Invalid column name 'System_AssignedTo__Name'.; 42S22;

Invalid column name 'System_AssignedTo__SID'.; 42S22

Query execution failed for dataset 'ds[Whatever]'

The Solution

Found in Jeff Hunsaker’s blog post:

  1. In TFS Admin Console, look up the account under “Account for accessing data sources” under the “Analysis Services” tab (Reporting » Edit).
  2. In SQL Server, add that account to the Tfs_Warehouse database, to the TFSEXECROLE role.

Good luck!

--Neno

SOLVED: Error ‘(405) Method Not Allowed’ when publishing a NuGet package to a NuGet server

The Problem

When trying to publish NuGet Packages to a NuGet server you get the error message:

Failed to process request. 'Method Not Allowed'.

The remote server returned an error: (405) Method Not Allowed.

The Solution

Found in this post on stackoverflow.com:

When you LIST packages in NuGet server you point to http://nugetserver.com/nuget. However when you are trying to PUSH or DELETE a package you need to point to http://nugetserver.com without the nuget folder in the path.

Good luck!

--Neno

Build fails with missing file: System.Management.Automation.dll

The Problem

  • The Build breaks with the following message:

Exception Message: Could not load file or assembly 'System.Management.Automation, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified. (type FileNotFoundException)

The Solution

The Cause

  • You might be using the Community TFS Build Extensions. These include the InvokePowerShellCommand activity, which has a dependency on this .DLL

--Neno

Build fails to find GraphCmd.exe (Layer Diagram Validation)

The Problem

  • The Build breaks with the following message:

Error message:
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v11.0\ArchitectureTools\Microsoft.VisualStudio.TeamArchitect.LayerDesigner.targets (148): The "GraphCmd" task failed unexpectedly. System.InvalidOperationException: Cannot start process because a file name has not been provided.

The Solution

Add this xml snippet into all of your Modeling project (*.modelproj) files:
<PropertyGroup>
    <GraphCmdPath Condition="'$(GraphCmdPath)'=='' and '$(Registry:HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\11.0\Architect@GraphCmdDir)' != ''">$(Registry:HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\11.0\Architect@GraphCmdDir)</GraphCmdPath>
</PropertyGroup>

--Neno

How to compile projects that reference Microsoft.Office.Interop assemblies with a build server

The Problem

A project that references Office interop assemblies (Microsoft.Office.Interop) fails to compile on TF Build (or VSO’s Elastic Build Service).

The error message might be similar to this one:

The type or namespace name 'Office' does not exist in the namespace 'Microsoft' (are you missing an assembly reference?)

The Solution (based on this forum post)

You want to check-in the interop assemblies.

  1. Create a “Lib” folder and add all relevant assemblies, like:
    • Microsoft.Office.Interop.Word.dll
    • Microsoft.Office.Interop.Excel.dll
    • Microsoft.Vbe.Interop.dll
    • OFFICE.DLL
  2. Removed the references to your Office interop assemblies and add references to the assemblies in your libs folder.

--Neno

Clean-up after in-place upgrade to TFS 2013

After performing an in-place upgrade to TFS 2013, you might want to clean up the old TFS folder:

You can free up almost 2 GB by deleting the old TFS 11.0 folder.

How to do a clean uninstall of Visual Studio 2012?

Questions

  • How can I easily remove Visual Studio 2012 and all of its components?
  • Is there an install utility for Visual Studio 2012?

Answer:

Yes, the uninstall utility is integrated into VS 2012 setup.

If you want to completely uninstall Visual Studio 2012, you can run VS 2012 setup with the following parameters:

vs_ultimate.exe /uninstall /force

Source: http://support.microsoft.com/kb/2771441/EN-US#Force

--Neno

Posted: Tue, Oct 15 2013 22:45 by neno | with no comments
Filed under:
More Posts Next page »