Cloaked folders in the TFS Build Workspace


Here is a little Trick I find most people don’t know about.

When setting up a Build Definition you have to tell the build server where to get the source code from. We do this by declaring the folders to download from on the workspace tab of the build definition. It takes time to download all the files to the build server so you don’t want to get any unnecessary folders from source control.

Generally you can just select the root of the branch and pick up everything from there. Although there are times when the build you are creating does not require all the files in the branch. Lets say for example that you have two builds that run one that only builds the application and one for your WIX projects to create an install package. You likely want to keep all the files together for branching purposes. Something like this:


The folders in my example are for the following:
Builds files used by the build process specific to this application. Includes third party DLL’s we do not have the source code for.
Install WIX Project.
Resources Various resource files used by the application.
Source Application Source Code.

Now what I want is to get certain folders when building the app for a CI build and different ones when creating an install package.

CI Build

Install Package









I could just do this. But then I am getting more than I need in both cases.





Or to get just what I need I could do this. (Making sure I put everything into the correct folder on the build agent.

CI Build: image





Installation Package Build:image





Or I could use the cloaked status to let the build know not to get a particular folder.

Therefore on the CI Build where I want everything but the Install Folder I could do this: image




And on the Install Package Build I don’t need Source or Resources so I could do this:image

Concatinating string in a batch file

Batch file? Yes you heard me, batch file, you know .cmd.

This is an odd post for me, however I needed to do this recently and don’t want to forget how I did it. Smile


When automating builds I often take advantage of invoke process. It’s a nice way to keep my build process generic and call out to a process that may change over time or is specific to branch I am building. It allows me to keep some of the process specific to the source code, by storing the batch file with the source code. This also allows me to version the batch file if it changes over time, and ensure it available to the build server without installing it on the build server.  None of this has anything to do with my blog post. Whatever the reason you may be calling out to a batch file using invoke process read on.

Have you ever had trouble passing variables like DropLocation or SourcesDirectory. If they have spaces in them you will need to put them in quotes. Lets say I want to pass the DropLocation to a batch file.

The arguments property of my invoke process would look like this. """" + DropLocation + """"

Notice the double quotes around the variable, to ensure they are passed to the batch file as one argument.

“\\My File Server\Drops\BuildDefinition_1.3.4636.1”

Without the quotes in this example my batch file would have received 3 arguments

  1. \\My
  2. File
  3. Server\Drops\BuildDefinition_1.3.4636.1

Therefore I need the Quotes.

In my batch file I want to access files in a subfolder of my DropLocation. So I need to concatenate the path passed in with another folder. Ultimately I want the location

\\My File Server\Drops\BuildDefinition_1.3.4636.1\MyFolder

The problem is with the double quote at the end of the argument this %1\MyFolder would end up being this “\\My File Server\Drops\BuildDefinition_1.3.4636.1”\MyFolder

Here is how to fix that problem.

First create a variable to hold your argument


Then when you go to use the variable use a little string manipulation. Specifically ( :~f,e ) where f = the number of characters to strip from the start of the argument and e the number of characters to strip from the end.

Therefore to get ride of the double quotes at the end of our argument just remove the last character.

Like this %DROPLOCATION:~0,-1%\MyFolder"

The above syntax will result in this “\\Server\Drops\BuildDefinition_1.3.4636.1\MyFolder” making it possible to add my folder in the batch file instead of in the build process.

Serious Test Case Design


I am doing part of a talk at the Microsoft Canada Office on Thursday September 13th at 6:00pm.

Here is the blurb:

Testing with Microsoft Test Manager

Coded UI tests provide a way to create fully automated tests to validate the functionality and behaviour of your application’s user interface. We’ll cover some of the ways you can use these methods of testing with TFS 2012 to increase your teams productivity. Accelerate your testing with Fast Forward for Manual Testing to quickly re-run test steps or even entire test cases in the future.

Come out it should be fun.

TFS 2012 Team Explorer

I did a little video for Tech Days TV demoing some of the new features of the Team Explorer.

You can check it out here.

What’s new in TFS?

Recently I have been on Tech Days TV and Align IT with some friends of mine.

All the shows, pertain to the next version of TFS coming out in 2012.

If you want to watch them here is the link.

TFS11 Shelving

If you are like me and a fan of Shelving in TFS you are going to love TFS11.

Here are some new features for Shelving that have me excited about the next release.


Instead of a copy, unshelve is now a merge. You can take those changes and Merge them in with your current local changes. Also this means that on a Gated Check in the Shelveset is merged with the main base of code prior to the private build.

Work items

In the new Team Explorer you can select work items that are In progress. So that when you check in the changes the changeset is associated to the work item.

If you Shelve this work to do something else the Work item is stored with the Shelveset. When you Unshelve to work on it you will get the work item also.


Select a shelveset while you have work in progress. Notice the Switch command below. This allows you to take your In Progress work and swap it out with a Shelevest.

TFS Work Item History Compare


I had a customer that was looking for a way to see the history of a work item in an easier to compare format then the work item itself.  I searched for such a tool, didn’t find one, so I wrote this.

I uploaded it to CodePlex in case anyone would like to use it or extend it. If you just want to try it out you can download the latest version from CodePlex.

The app is pretty simple. Simply run GetHistory.exe select the server and projects you want to query and hit connect.

On the main form below, the Project drop down will be populated with the list of projects you selected from the connection screen.

Enter a Work Item ID from that project and hit enter or click Get History.

The grid will fill with each revision of the work item. If the data in a field is different than the previous revision it will be displayed in red.

Other Options

Go to the Fields to Ignore tab to select work item fields you don’t care to see. Some are obviously pointless and should be turned off by default. (ie: Rev, ID, Area ID, Iteration ID, History, Work Item Type)

Connect to TFS: Use this button to switch to another server or collection or add or remove a project from the drop down.

Clear:  Clears the form of the last retrieved work item data.

Export to Excel: Do I really need to tell you what this does?

I hope someone out there finds it useful.

AlignIT - Manager Tech Talk

Tomorrow Barry Gervin and I will be interviewed on AlignIT with Ruth Morton and Jonathan Rozenblit.

We will be discussing the Pros and Cons of upgrading to the next version of VS and TFS. Affectionately known as vNext or Dev11.

Feb 29th MS announced the release of Windows 8 Customer Preview and Visual Studio 11 Beta.

Looking forward to the discussions. Watch for it on AlignIT

O# at the movies is back

I remember the first ever event we did in a theater. It was all about Whidbey, remember that? Then the next year Nick Van Exan our student and part time graphics guy created a movie poster to promote the event. I think it was Barry Gervin as Dr. Evil, very funny stuff.

The tradition continues.

ObjectSharp is pleased to present it's 2012 "At The Movies" event!

At this 3-hour live morning event at the Scotiabank Theatre, on Tues 1 May 9-12 noon, you will see and hear about Microsoft's new developer tools for 2012:

Metro (Win 8 + Mobile)
VS 2012
TFS 2012 + Test Manager 2012

...from ObjectSharp's MS MVPs: Dave Lloyd, Bruce Johnson, Barry Gervin, Colin Bowern, Deb Forsyth and Atley Hunter

PLUS:  your admission includes:

Coffee + Popcorn + Soft Drinks

AND ...  multiple draws for Microsoft and Telerik cool stuff!

What does it cost?

General Admission is $25 (or register by Friday April 14 and pay just $15)!

Register Online Now!

What if I have questions?

e-mail us at
or call: 416-649-3690 (ext 0)

Editing a Build Process

If you want to edit your build process and utilize some of the custom activities in the  Community TFS Build Extensions. You may be finding it tough to drag the activity into your Workflow. Or Intellisense may not be working like you saw in that demo. Below are the steps to help you create a project to store your custom build processes and easily edit them.

First Download the Community TFS Build Extensions and copy them into a folder in source control. I like to put them in a folder under the BuildProcessTemplates folder created from your Process Template, called Custom Activities.

For example: $/ObjectSharp Projects/BuildProcessTemplates/CustomActivities

You need to make sure the build server knows where to find these so Change the Build Controller property Version control path to custom assemblies to this location in source control. You can get to it by right clicking on the Builds node in Team Explorer and selecting Manage Build Controllers. Select the Controller and click the properties button.

Make a copy of the Build Process Template that you want to edit and make sure it’s in the BuildProcessTemplates folder under source control.

  • Add the Custom activities to your toolbox.

in Visual Studio select Tools | Choose Toolbox Items… from the main menu.

On the System.Activities Components tab browse for the TFSBuildExtentions.Activities.dll and add it.

  • Create a new Class Library Project

Delete the Class1.cs that gets created.

Add the following references to the project:

From the .Net tab on the Add Reference dialog:

From C:\Program Files\Microsoft Visual Studio 10.0\Common7\IDE\PrivateAssemblies
From where ever you installed it on your machine

  • Add the Build Process Template to the project.

Right click on the project and select Add | Existing Item… from the context menu.
Navigate to the build process template you want to edit 
Click on the arrow next to the add button to select Add As Link

Now you can work on your build process in place from within a project so you have all the references you need to drag activities in and have the benefit of intelitrace.