Custom Activities in TFS2010
There is a good post on Jim Lamb’s blog on how to customize tfs2010 build, but I decided to blog my experience because I need some more time to make it work.
The steps to create a custom activities in tfs2010 are the following ones. First of all create an activity, like this simple TweetActivity one. Respect the example of Jim, I need to add also the BuildExtensionAttribute to make it run.
This is a very simple activity that simply tweet a message. Then after you compile it, you need to save the assembly in a specific file of your source code, to be available from build agent.
You must configure the Build Controller to point at a specific folder to have it understand where to find assemblies that contains custom activities. These steps are really well described in Jim’s post, so I do not give further details.
Then you face the first problem, if you copy the default workflow of the build (to avoid changing the basic one) and open it into Visual Studio, you don’t see your custom action in toolbox so you are not able to add it to your build process. To solve this I decided to add my custom activity by hand, editing the xaml file. First of all you need to add the namespace
Now you need to add your custom activity in the workflow flow, I decided, for simplicity, to add it before the get latest activity, so it is the very first activity that gets executed. After all I only wants to test if my action gets executed during the build.
Xaml files are simple enough to edit by hand, as you can see to add the custom activity, just add a da:TweetActivity (da is the alias I used for my namespace) and configure the properties. Then I commit everything and started a build.
Ok it works :).
Tags: Team Foundation Server