The blogs of Black Marble staff

How to use the TFS 2010 Community StyleCop Build Actvity (Addendum)

Recently I posted on How to use the TFS 2010 Community StyleCop Build Activity and I am sure it all sounded very awkward and complex, well it did to me.

The point I should have made is that you don’t have to follow this process every time you want to make use of the custom activity. As long as the build process template is the same between to builds you can just copy it, you only need to follow the method in the post the first time.

So assuming you have followed the process in my last post and want to add the same build process to another project, lets say in another Team Project Collection, you do the following

Get the files onto the build box
  1. In VS2010 open Source Control Explorer select your Team Project and map the BuildProcessTemplates folder to a location on your local disk.
  2. Create a new folder under the BuildProcessTemplates called Custom Assemblies
  3. In this new folder copy all the assemblies from the equivalent folder you created in my last post
  4. Into the BuildProcessTemplates copy the edited build process template that uses the custom activities, again from the equivalent folder in my last post
  5. From within Source Control Explorer add these new files and check the files into TFS.
  6. Open Team Explorer, right-click on Builds and select Manage Build Controllers
  7. Select the controller to configure, and then select Properties
  8. Set the Version control path to custom assemblies to the location just created under version control containing your added assemblies
  9. You might want to restart the build service, it should automatically pick up the changes, but I usually do a restart to make sure

Making use of the build

  1. Create a new build and set it up as normal.
  2. On the process tab press the new button and browse to find the newly added process template


Once this is done can now save the build and queue it and all should work.

So the 2nd, 3rd etc. uses of a custom activity are not too bad as the first, as long as you can keep your process templates generic.

Professional Foundation Server 2010

Over the holiday I have been reading Professional Foundation Server 2010 by Ed Blankenship, Martin Woodward, Grant Holiday and Brian Keller, yes I know how to have time off and have fun!

So who is this book for? It is a comprehensive guide to TFS 2010, the components and their usage, but this does not mean the book is only for teams new to TFS or people planning to take certification exams. Spread throughout there are useful little titbits of information where you find yourself going ‘I never know that’ or ‘arr.. that explains so much


So I would suggest it is well worth a look for anyone who is working, or planning to work, with TFS.

It is even available as Kindle edition, how times change, used to be only novels for the Kindle!

Publishing Access Services Database to SharePoint 2010 gives ‘<URL> did not respond…’

While building a portion of our demo SharePoint 2010 farm, I encountered an error when publishing an Access 2010 database to a SharePoint 2010 Access Services site.

The error which was shown was ‘<URL> did not respond. Either the server does not exist, Microsoft Access Services are not enabled on the server, or the server is using an older version of Microsoft Access Services which is not compatible with Access 2010’:

Access Services Publish Error

After checking that the Access Services farm and web application features were enabled, and that the enterprise features were enabled on the site collection to which I was attempting to publish the Access database (all were fine), I looked in the server application logs on the WFE servers in the demo farm, and on one of the farm servers saw the error ‘There is no default Access Services Application Proxy’:

Event Viewer Error

Checking the Service Application Associations (Central Administration –> Application Management –> Configure service application associations) showed that the Access Database Service proxy was not associated with the default proxy group:

Proxy Associations

After adding the Access Database Service proxy to the default group, publishing the Access database to SharePoint proceeded without a hitch.

In our case, the proxy not being associated with the default proxy group was due to us using PowerShell to configure the Access Service Application. If you do the same, check whether the proxy has been associated with the default group (or whatever proxy group you want it associated with).

Developer Update for April

Microsoft as ever have been busy with new drops and SP1 refreshes of technology for us all to embrace and here is a summary update for this month

The Microsoft F# (, April 2011 Community Technology Preview is available here

While not all new if you are looking at F# I would suggest keeping an eye on

F# PowerPack

F# Samples

F# Developer Center

For learning F# check out the Try F# tutorials here

Anders announced that in the new generation of the .Net languages at PDC 2010 more compiler automation of classic tasks in this case Async functions and beyond will be possible. You can watch it here. The SP1 previews of the new compilers are available now (see below)

C# Language Specification for Asynchronous Functions get it here

VB Language Specification for Asynchronous Functions get it here

A general overview of  Asynchrony in .NET is available as a Whitepaper here

Visual Studio Async CTP including the language changes (SP1 Refresh) get it here

a related useful read is Task-based Asynchronous Pattern which is a new pattern for asynchrony get it here

another interesting document is Introduction to TPL Dataflow which is a library for building parallel and concurrent applications get is here

It is useful to note that while not encouraged the EULA does allow for production use (but on your own head be it)


How to use the TFS 2010 Community StyleCop Build Activity

[Updated 27th April 2011 Also see How to use the TFS 2010 Community StyleCop Build Actvity (Addendum)]

The Codeplex Community TFS Build Extensions contains a StyleCop activity, but the way to use it is less than obvious. This is not helped by the complexity in using any custom activity within TFS 2010 builds. In this post I will try to show how to get going with the StyleCop activity, which might shed some light on using other custom assemblies.

Get the files

  1. Download and install StyleCop on you development PC. The alpha custom activity is built against StyleCop
  2. Download and unzip the Community TFS Build Extensions to a directory on you development PC.

Get the files onto the build box

The assemblies that contain the custom activity and StyleCop need to put under source control so they are available to the build controller and agent(s).

  1. In VS2010 open Source Control Explorer select your Team Project and map the BuildProcessTemplates folder to a location on your local disk.
  2. Create a new folder under the BuildProcessTemplates called Custom Assemblies
  3. In this new folder copy all the assemblies from the unzipped TFS Build Extensions and StyleCop folder (found in Program Files)
  4. From within Source Control Explorer add these new files to the new Custom Assemblies folder and check the files into TFS.
  5. Open Team Explorer, right-click on Builds and select Manage Build Controllers
  6. Select the controller to configure, and then select Properties
  7. Set the Version control path to custom assemblies to the location just created under version control containing your added assemblies

Get the custom activities into Visual Studio

Next we need to get the activity into Visual Studio so we can add it to build process

  1. Open Visual Studio 2010
  2. Create new Class Library project, this new project is only going to be used as a container for the editing of the build process template.
  3. Delete the Class1.cs file
  4. In Solution Explorer right click and select Properties., make sure the new project does not build in any configuration.

Now we have a project to work with, we need to get a process template into it, this can be done by branch the process template into the project for adding it as a link. In this example I used a link to one of the standard template in the BuildProcessTemplates folder, for simplicity, but I would normally recommend at least copying the process template in the BuildProcessTemplates folder prior to editing it.

  1. Make sure BuildProcessTemplates is mapped in you current workspace and get a local copy on your development PC
  2. In the new project select Add Existing Item and browse to local folder mapped to the BuildProcessTemplates, select the template your wish to edit. But, don’t just press the Add button, but use the drop down to select Add as link.
  3. On the added file set the build action property to none
  4. Select Add Reference and add references to all the assemblies from the unzipped TFS Build Extensions
  5. Open the newly added process template in VS2010, this can be slow, so wait…..
  6. Open the toolbox and you should see all the standard build activities
  7. Right click in the toolbox and select Choose Item, select browse and select the file TfsBuildExtensions.Activities.StyleCop.dll.
  8. The StyleCop activity should now be in the toolbox

Editing the Process template

Well at last we can start to edit the process template, that took a while didn’t it!

Using the standard DefaultBuild template find the ‘Compile the Project’ sequence and add the activities as show in a graphic below. I have chosen to add the sequence inside the compile the project so we can pickup the solution file’s location, but you could choose a different location of that meets you needs. The StyleCop activity does not require to be after the compile stage as it works against the .CS files, not the compiled assemblies.


Here are the breakdown

  1. Add a new sequence, I named it “Run StyleCop”
  2. Add the following variable with a scope of the “Run StyleCop” sequence
    • StyleCopFiles – iEmumerable<string>
    • StyleCopSettingsFile – string
    • StyleCopResults – bool
    • StyleCopViolations - int32
  3. Add a FindMatchingFile activity, set the result to StyleCopFiles and the MatchPattern to String.Format("{0}\**\*.cs", BuildDirectory). This will recursively find all the .CS files in the project and add them to the collection.
  4. Add an Assign activity, set the to property to StyleCopSettingsFile and the value to String.Format("{0}\Settings.StyleCop", localProject.Substring(0, localProject.LastIndexOf("\"))). We use the name of the .SLN file to find the root folder to find the StyleCop settings file.
  5. Add a WriteBuildMessage activity, set the importance to High (so we always see the message) and the Message to String.Format("About to run Stylecop with {0}", StyleCopSettingsFile)
  6. Add a StyleCop activity with the following properties (these are a minimum to get it working, to see what the other options do I would suggest you look at the unit tests in the Codeplex activities source.)
    • SettingsFile = StyleCopSettingsFile
    • SourceFiles = StyleCopFiles.ToArray()
    • Succeeded = StyleCopResults
    • TreatViolationsErrorASWarnings = True  - setting this is down to how you want violations to appear in the log, for this example I wanted warnings
    • ViolationCount = StyleCopViolations
  7. Add another WriteBuildMessage activity, again set the importance to High and the Message to String.Format("StyleCop Successed:{0} with {1} violations", StyleCopResults, StyleCopViolations)
  8. Save the edited process template and check it into TFS

Running the Build

If you have not done so already create a build using this process template. Queue a new build using the template. If it is all OK you should see a log similar to the graphic below


Notice that the FXCop (code analysis) results appear within the main build summary (green), but the StyleCop violations (red) appear in the Other Errors and Warnings section. Unfortunate this cannot be altered. You cannot add extra bits to the main build summary. However, you could choose to fail the build if there are StyleCop violations

So I hope this has made the use of the StylCop activity more obvious, so you can bolt it into your build process and trigger all the argument in your team as to which rules should be used.

Now I have three TFS build instances on my VM

A while ago I posted on my experiences running multiple instances of 2010 build service on a single VM. Well a couple more experiences as now one of my VM is running 3 instances.

Firstly it seems to work OK, you have to have the right build profile i.e. fairly low load but a need to support many Team Project Collections. This is not a solution for a highly loaded build environment. At Black Marble we run a TPC per client model and tend to have fair few projects on the go at any one time, so need plenty of build controllers. However, in general the builds are small, taking minutes not hours If we have a seriously long running build I would still create a dedicated build service VM.

So what have I learn since the last post

  • Set the agents working directory differently for each agent on the VM. You will probably be OK if you don’t, as the $(BuildAgenId) should differ, but life is easier of you know what is where. So I use $(SystemDrive\Build1, $(SystemDrive\Build2 etc. as opposed to the default $(SystemDrive\Build.


  • When you create the new service instance using the Sc.exe command line remember to make sure it starts automatically when the operating system is rebooted. Stupid mistake but I keep make it!

Release of Black Marble’s WP7 TFS Phone Explorer

Over the weekend we have released Black Marble’s WP7 TFS Phone client to the WP7 Marketplace.


This app allows the user of a WP7 phone to access their TFS server to perform common operations. They can:

  • See recent builds and drill into the results
  • Queue new builds
  • View and add work items

This client talks via a custom web service to a TFS 2008 or 2010 server, which are available from Black Marble. But if you just want a quick look to see what it can do we have setup a demo web service so you can trial the application, just use the default account details stored in the application. These are 

  • UID demo
  • PWD demo
  • DOMAIN demo
  • URL

So if you have WP7 and TFS why not download the trial version and have a look at it? Just search the market place for Black Marble and TFS Phone Explorer or try the marketplace deep link. We are interested to hear your thoughts

Windows Azure SDK 1.4 released

The Windows Azure SDK 1.4 refresh is available which adds in Web Deploy integration. This allows the developers to increase their productivity by using web deploy rather than having to repackage and redeploy the application. It is available for down load here and click the “Get Tools & SDK” button. Further information on this release can be found here

MSDN subscribers now get more Windows Azure Platform benefits

If you are an MSDN subscriber (Ultimate or Premium) you now get more Windows Azure resources. Professional subscribers are now also included in the promotion.

See here for more details. If you have already taken up this offer and you are an MSDN Premium subscriber then you will automatically be upgraded to the MSDN Ultimate offer.


In order to activate your benefits

  • Sign-in to your MSDN benefits page
  • Click on the Windows Azure Platform link from My Account and follow the steps to activate Windows Azure (for limited free access). You'll need your credit card or follow the Steps to set up invoicing for Windows Azure to sign up. If you use more than the amount of services included with your MSDN subscription, you will be billed to your card for these overages. You can visit the Microsoft Online Services Customer Portal to look up your usage at any time.
  • Go to the Windows Azure Developer Portal to access your Windows Azure subscription